Tuesday, November 20, 2012

Creating MDI Child Forms

MDI (Multiple-Document Interface) applications should have a MDI Parent form which will act as the parent for all other forms in the application. In this post we shall see on how to create a MDI Child form in a C# Windows Application and associate it with the MDI Parent form.

First let us create the MDI Parent Form.

1. Create a new / open an existing C# Windows application.
2. Create/Open the form which needs to be set as the MDI Parent form.
3. Open the Properties of the form (View -> Properties Window or Press F4 key)
4. Set the
IsMdiContainer property to true.
5. Set the WindowState property of the form to Maximized, this will open the form in Maximized mode.

Now let us create the MDI Child form
1. Add a new Windows Form to the Project
2. Set the
MaximizeBox and MinimizeBox properties of the new form to false.
3. In the MDI Parent window, add the following code to the event handler which will open the Child form, typically child forms will be opened in the Menu click or Tool bar button click events in the MDI parent forms.

            frmChild objChild = new frmChild();
            objChild.MdiParent = this;

Search Flipkart Products:

No comments: