Creating MDI Parent Forms
The foundation of a Multiple-Document Interface (MDI) Application is the MDI parent form. This is the form that contains the MDI child windows, which are the "sub-windows" wherein the user interacts with the MDI application. Creating an MDI parent form is easy, both in the Windows Forms Designer and programmatically.
To create an MDI parent form at design time
- Create a Windows Application. For more information, see Creating a Windows Application Project.
- In the Properties window, set the IsMDIContainer property to true.
This designates the form as an MDI container for child windows.Note While setting properties in the Properties window, you can also set the WindowState property to Maximized, if you like, as it is easiest to manipulate MDI child windows when the parent form is maximized. Additionally, be aware that the edge of the MDI parent form will pick up the system color (set in the Windows System control panel), rather than the back color you set using the Control.BackColor property.
- From the Toolbox, drag a MainMenu component to the form. Create a top-level menu item with the Text property set to &File with submenu items called &New and &Close. Also create a top-level menu item called &Window.
The first menu will create, and hide menu items at run time, and the second menu will keep track of the open MDI child windows. At this point, you have created an MDI parent window. For more information on creating menus and menu items, see Adding Menus and Menu Items to Windows Forms.
- Press F5 to run the application. For information about creating MDI child windows that operate within the MDI parent form, see Creating MDI Child Forms.