MDI refers to opening multiple control forms in the same form
1, set: Ismdicontainer:true in the attribute;
The form becomes gray to become an MDI form container
2, the MDI generally use the menu as the open way
3. The child form opens in MDI and needs to be set in the MDI form first
Cases:
Form2 F2 = new Form2 ();
F2. MdiParent = this;
F2. Show ();
4. Maximize window Opening
Object. Windowstate=formwindowstate.maximized
5. Open in Parent Panel container, restore button for hidden window
Object. Parent=panel;
6, no border
Formborderstyle:none;
7. Window opens only
List<form> formlist =NewList<form>(); Private voidSales Toolstripmenuitem_click (Objectsender, EventArgs e) { //window Unique BOOLhas =false; Form2 F2=NewForm2 (); foreach(Form Finchformlist) { if(f isForm2) { has=true; F2= f asForm2; } } if(has) {foreach(Form Finchformlist) {f.hide (); } f2. Show (); } Else { //define to MDI containerF2. MdiParent = This; //Open MaximizeF2. WindowState =formwindowstate.maximized; //Panel ParentF2. Parent =Panel1; //Show OpenF2. Show (); Formlist. ADD (F2); } }
MDI container of WinForm