I have an MDI-Parent form name frmMain where I load lots of child forms in.

frmMain has a Menu on the top which covers a space about say 1000*25. When child forms load, they can be born in any location of frmMain, and sometimes they go behind the menu.

Is there a way to make frmMain think the space under this menu should not be used (Something like form region)? Or I should explicitly tell the child forms to be located below height=25?

enter image description here

the blue portion is a menu and above it, the red portion is a panel.

有帮助吗?

解决方案

I don't know if this is convenient for you, but you could add a Panel/FlowLayoutPanel to your Mdi window in the desired child forms space and add the forms to the panel like this :

Form frm = New Form();
frm.TopLevel = False;
frm.Show();
FlowLayoutPanel1.Controls.Add(frm);

Set the FlowLayoutPanel.BackColor to Transparent so it looks like an mdi container.

其他提示

I think there is no way to do this you must set position pragmatically for each form or set their start up position to center parent.or simply use Child.ShowDialog() instead of using Child.Show(),with Show Dialog child window Is Focused until closed.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top