Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top