9. How to create an MDI form
1. Create a new Windows Application project
2. Add two forms: Form1 and Form2.
3. Set the IsMdiContainer attribute of Form1 to True. Make it an MDI main form.
4. Add a RichTextBox Control to Form2 and set the Dock to Fill.
5. drag a MainMenu in the Tools form to the form Form1, and create a menu File | Windows | Help. The File contains the New and Exit menu items; windows includes Cascade and Horizontal.
6. Set the MdiList attribute of the Windows menu item to True, so that each MDI subwindow is automatically added under the Windows menu item.
7. Double-click the New menu item and add the following code:
Private void menuNew_Click (object sender, System. EventArgs e) <? Xml: namespace prefix = o ns = "urn: schemas-microsoft-com: office"/>
{
Form2 NewMdiChild;
NewMdiChild = new Form2 ();
NewMdiChild. MdiParent = this;
NewMdiChild. Show ();
}
8. Add the following code to Windows Cascade and other menu items:
Private void menuWindowCasca_Click (object sender, System. EventArgs e)
{
This. LayoutMdi (MdiLayout. Cascade );