C# winform在表单加载事件中修改高度
我想在加载事件中调整WinForm的大小。 我写了这句话C# winform在表单加载事件中修改高度,c#,winforms,height,C#,Winforms,Height,我想在加载事件中调整WinForm的大小。 我写了这句话 this.Height -= 100; 在Form_load事件中,但它不起作用,如何实现这一点 private void FormMain_Load(object sender, EventArgs e) { try { //somecode if (m_HideControls) { // do some controls
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)
{
}
}
只要窗体窗口状态设置为Normal,并且新的大小不违反窗体的最小/最大大小,就可以正常工作 将表单的“Autosize”属性设置为False对我起到了作用。这应该可以,没有问题。在订阅表单加载事件的位置发布更多代码?是的,您是对的,这是因为最小大小属性:/