MDI Forms From Hell
-
Hi! I want to make an MDI application. I want the Parent form (frmMain to hold a menu and a Panel (docked top). And I want the MDIChild Forms to be encased, but below the Panel. How do I do that ? Thanks! and cheers :) Antoine This by our hands that dream, "I shall find a way or make one!"
-
Hi! I want to make an MDI application. I want the Parent form (frmMain to hold a menu and a Panel (docked top). And I want the MDIChild Forms to be encased, but below the Panel. How do I do that ? Thanks! and cheers :) Antoine This by our hands that dream, "I shall find a way or make one!"
antoine@orchus-tech wrote: I want to make an MDI application. I want the Parent form (frmMain to hold a menu and a Panel (docked top). And I want the MDIChild Forms to be encased, but below the Panel. How do I do that ? 1. Make frmMain a MDI form by changing its IsMDIContainer property to true. 2. Add or "drag" a panel from the Toolbox to frmMain form in the form designer and then change its Dock property to Top. 3. Add or "drag" a menu from the Toolbox to frmMain. 4. Make sure that you have a form added to your project for the MDIChild window. 5. Depending on how you want to handle your child window creation, these steps may vary. If you will be implementing a "New" command, then in its event handler in the frmMain class, type (frmChild should be replaced with whatever name you named your child form): line 1: frmChild child = new frmChild(); line 2: child.MdiParent = this; line 3: child.Show(); 6. If you want things to be a little nicer, add a member variable to your frmMain class, possibly by the name of "childCount" of the uint type. Then between lines 2 and 3 from above, type: line 3: childCount += 1; line 4: child.Text = "Document " + childCount.ToString(); Please note that the line numbers above are there merely for reference only. After performing these steps, you should have the beginning workings of an MDI App. Hope this helps. :) Happy Programming and God Bless! Internet::WWW::CodeProject::bneacetp
-
antoine@orchus-tech wrote: I want to make an MDI application. I want the Parent form (frmMain to hold a menu and a Panel (docked top). And I want the MDIChild Forms to be encased, but below the Panel. How do I do that ? 1. Make frmMain a MDI form by changing its IsMDIContainer property to true. 2. Add or "drag" a panel from the Toolbox to frmMain form in the form designer and then change its Dock property to Top. 3. Add or "drag" a menu from the Toolbox to frmMain. 4. Make sure that you have a form added to your project for the MDIChild window. 5. Depending on how you want to handle your child window creation, these steps may vary. If you will be implementing a "New" command, then in its event handler in the frmMain class, type (frmChild should be replaced with whatever name you named your child form): line 1: frmChild child = new frmChild(); line 2: child.MdiParent = this; line 3: child.Show(); 6. If you want things to be a little nicer, add a member variable to your frmMain class, possibly by the name of "childCount" of the uint type. Then between lines 2 and 3 from above, type: line 3: childCount += 1; line 4: child.Text = "Document " + childCount.ToString(); Please note that the line numbers above are there merely for reference only. After performing these steps, you should have the beginning workings of an MDI App. Hope this helps. :) Happy Programming and God Bless! Internet::WWW::CodeProject::bneacetp
Hi! THis is what I first did. But the child can move 'under' the panel, as though it did not exist. Also, when you max the child, its min-max box goes way up there under the parents' one, instead of under the panel. Thanks! Antoine This by our hands that dream, "I shall find a way or make one!"
-
Hi! THis is what I first did. But the child can move 'under' the panel, as though it did not exist. Also, when you max the child, its min-max box goes way up there under the parents' one, instead of under the panel. Thanks! Antoine This by our hands that dream, "I shall find a way or make one!"
Oh... The behaviors that you described are default to Windows MDI apps. You could remove those buttons from your MDI Child and put a button or some other UI on your panel to handle the close, min, and max events. As far as constraining the child's movement, you could do calculations to find the size of the parent window and then calculate how much the top area (titlebar, menubar, panel) takes up. Then constrain the children forms using that info. I hope this helps. Happy Programming and God Bless! Internet::WWW::CodeProject::bneacetp