简体   繁体   English

Windows窗体中的MDI子窗体

[英]MDI child form in Windows Forms

I have a form with an MDI container marked as true. 我有一个带有标记为true的MDI容器的表单。 This form is a parent form which has a child form. 此表单是具有子表单的父表单。 In the child form I use this code for loading it in maximized size. 在子窗体中,我使用此代码以最大尺寸加载它。

this.WindowState = FormWindowState.Maximized;

I use this codes for showing the child form : 我使用以下代码显示子表单:

Form2 f2 = new Form2();
f2.MdiParent = this;
f2.Show();

And also child form is fixed single so that it won't be able to resize. 子表单也固定为单个,因此无法调整大小。 But however i disable maximize button it will disapper and can be restore down. 但是,无论我禁用最大化按钮,它都会消失,并且可以还原下来。

尝试这个:

f2.MinimizeBox = false;

You can try 你可以试试

f2.ControlBox = False;

That could hide both the MaximumBox and MinimumBox but not the Close Button. 这可能会同时隐藏MaximumBox和MinimumBox,但不会隐藏“关闭”按钮。

Had the same problem, what ended up doing the trick was handling the OnMove event and resetting the visibilities there (even though they are already set to false). 遇到同样的问题,最终解决问题的办法是处理OnMove事件并在那里重置可见性(即使它们已设置为false)。 Not sure why that works, but it did for me. 不知道为什么这样做,但对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM