【问题标题】:winform modify height in form load eventwinform在表单加载事件中修改高度
【发布时间】:2013-07-14 19:55:55
【问题描述】:

我想在 Form_load 事件中调整我的 WinForm 大小。 我写了一行

this.Height -= 100;

Form_load 事件中但它不起作用,我该如何实现?

private void FormMain_Load(object sender, EventArgs e)
{
     try
     {
          //somecode

          if (m_HideControls)
          {
               // do some controls visible to false
               this.Height -= 100;
          }
     }
     catch (Exception ex)
     {

     }
}

【问题讨论】:

  • 这应该可以,这没有错。发布更多代码
  • 您在哪里订阅了表单加载事件?
  • 是的,你是对的,这是因为最小尺寸属性:/

标签: c# winforms height


【解决方案1】:

将 Form 的“Autosize”属性设置为 False 对我有用。

【讨论】:

    【解决方案2】:

    只要您的 Forms Windowsstate 设置为 Normal 并且新尺寸不违反 Forms 的最小/最大尺寸,这应该可以正常工作..

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-15
      • 1970-01-01
      • 1970-01-01
      • 2012-09-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多