MDI Parent & Child Form
-
I'm developing a WinForm using C# and VS2005. I was wonder if it is possible to open up a childForm1 in maximize window of MDIparent and launch childForm2 on top of childForm1, but still keep childForm1 as MAXIMIZE. Here's a big picture. childForm1 > childForm2 (childForm1 Maximize and childForm2 on top) What I'm looking for is the code to keep childForm1 maximize and childForm2 launch on top. Please please please please please......advice!!!! Thank you!:~
-
I'm developing a WinForm using C# and VS2005. I was wonder if it is possible to open up a childForm1 in maximize window of MDIparent and launch childForm2 on top of childForm1, but still keep childForm1 as MAXIMIZE. Here's a big picture. childForm1 > childForm2 (childForm1 Maximize and childForm2 on top) What I'm looking for is the code to keep childForm1 maximize and childForm2 launch on top. Please please please please please......advice!!!! Thank you!:~
I don't believe it is possible to have a 'non-maximised' child form over the top of a maximised child form. Setting
TopLevel
to true throws an error so the only way I can see for you to do it is to resize the child form to the size of the Mdi area (not maximised)... This will allow you to have the other child form(s) over the top of it. You may need to bring the other forms 'tofront' (.BringToFront
) if the background form is clicked otherwise all front forms will be hidden. Alternatively... you can put other controls (buttons, labels etc) directly onto a MdiParent form: so if you only want one 'maximised' form... don't actually make it a form, make it a panel (for example) and put all other controls into this. The panel will not be 'allowed' to come forward as it is part of the MdiForm background. Hope this helps.
Matthew Butler
-
I don't believe it is possible to have a 'non-maximised' child form over the top of a maximised child form. Setting
TopLevel
to true throws an error so the only way I can see for you to do it is to resize the child form to the size of the Mdi area (not maximised)... This will allow you to have the other child form(s) over the top of it. You may need to bring the other forms 'tofront' (.BringToFront
) if the background form is clicked otherwise all front forms will be hidden. Alternatively... you can put other controls (buttons, labels etc) directly onto a MdiParent form: so if you only want one 'maximised' form... don't actually make it a form, make it a panel (for example) and put all other controls into this. The panel will not be 'allowed' to come forward as it is part of the MdiForm background. Hope this helps.
Matthew Butler
Thanks for your reply. I came up with another idea....but still need a little guidance. Okay, so if my childForm1 is maximize then i launch Form1 by itself, not in MDIParent(frmParent) and if I want to launch childForm2 from Form1 but make it in MDIParent, Maximize and close childForm1. Is it possible? frmChild2 Child2 = new frmChild2(); frmParent Parent = new frmParent(); Child2.MdiParent = frmParent.MdiParent; Child2.WindowState = FormWindowState.Maximized; Child2.Show(); foreach (Form childForm in frmParent.MdiParent.MdiChildren) { if (childForm != Child2) childForm.Close(); } break; But it didn't work.
-
Thanks for your reply. I came up with another idea....but still need a little guidance. Okay, so if my childForm1 is maximize then i launch Form1 by itself, not in MDIParent(frmParent) and if I want to launch childForm2 from Form1 but make it in MDIParent, Maximize and close childForm1. Is it possible? frmChild2 Child2 = new frmChild2(); frmParent Parent = new frmParent(); Child2.MdiParent = frmParent.MdiParent; Child2.WindowState = FormWindowState.Maximized; Child2.Show(); foreach (Form childForm in frmParent.MdiParent.MdiChildren) { if (childForm != Child2) childForm.Close(); } break; But it didn't work.
I'm not 100% sure what you mean... can you be a bit more descriptive/specific? Are you saying you want one MdiParent with child forms that can access each other? (Close each other etc)?
Matthew Butler