1. Set the parent form:
If you want to set a form as a parent form, simply set the IsMdiContainer property of the form to true.
2. Set the subform:
Make sure that the form is a subform of that form by setting it to the MdiParent property of a form.
The syntax is as follows:
1 Public Form mdiparent{get; Set;}
3. Arrange the MDI child form:
The syntax is as follows:
1 Public void LayoutMDI (mdilayout value)
Value: is one of the enumeration values for the MDILayout that defines the layout of the MDI child form.
| Enumeration members |
Description |
| Cascade |
Stacking MDI child forms |
| Tilehorizontal |
Flat water spread MDI child form |
| Tilevertical |
Tile MDI child forms vertically |
routines;
1: Public Partial classFormmain:form2: { 3: PublicFormMain ()4: { 5: InitializeComponent (); 6: } 7: 8:Private voidLoad Subform Toolstripmenuitem_click (Objectsender, EventArgs e)9: { Ten: Formchild_1 Frm1 =Newformchild_1 (); One: Frm1. MdiParent = This; A: Frm1. Show (); -: -: Formchild_2 Frm2 =Newformchild_2 (); the: Frm2. MdiParent = This; -: Frm2. Show (); -: -: Formchild_3 FRM3 =Newformchild_3 (); +: FRM3. MdiParent = This; -: FRM3. Show (); +: } A: at:Private voidPlain Water Shop toolstripmenuitem_click (Objectsender, EventArgs e) -: { -: LayoutMDI (mdilayout.tilehorizontal); -: } -: -:Private voidTile Vertically Toolstripmenuitem_click (Objectsender, EventArgs e) in: { -: LayoutMDI (mdilayout.tilevertical); to: } +: -:Private voidCascade Arrangement Toolstripmenuitem_click (Objectsender, EventArgs e) the: { *: LayoutMDI (Mdilayout.cascade); $: } Panax Notoginseng: -: }
C # learning Note--mdi form (multiple file interface)