You are on page 1of 3

Title: To Create Maximize Child MDI form In Windows Forms Application

Requirements: Windows Forms Application, C# and Visual Studio 2005 or later

Notes: Screen Shot Taken In Visual Studio 2017

Step 1: Create a New “Windows Forms App” in Visual Studio 2017 as shown below.

Step 2: Once the application is created, it will have a default “Form1.cs” file. Go to Properties
Windows for Form1 and set “IsMdiContainer” property as “False” as shown below.
Step 3: Now add another Windows Form with the name Form2.cs as shown below.

Step 4: Double click on Form1, it will generate Load event as shown below.

Step 5: Now add the code below to the Load event.

Form2 frm = new Form2();


frm.MdiParent = this;
frm.Show();

The first line will create a new object of Form2. The 2nd line will set the “MDI” as Form1 (this
keyword refers to Form1) and in the final line, Form2 will be shown as Child form in Form1.
Step 6: Till now, the child Form2 will be shown as small windows in MDI. To make it maximize, in
Form2, go to the Code View and override OnResize event as shown below.

The result is shown below.

You might also like