How to Arrange the Display of Multiple MDI Child Forms in C#

Introduction

As my previous article helps you to learn create procedures. Now I am going to tell about the working of LayoutMdi Method. The LayoutMdi Method is used with MdiLayout enumeration to rearrange the child forms in an MDI Parent Form. 

Get to Work

With the help of below given example, you can learn how to use LayoutMdi method with MdiLayout enumeration for the Mdi Parent Form and you have to use enumeration in the code of click event of the Cascade Windows menu item.
 

Step to Create and Implement MDI Child Form

  1. Assumes there is an MDI parent form having MenuStrip with option New, Window and Close in New Menu, main form contain one Child form having a RichTexBox. For details, see Creating an MDI Form.
     
    1.gif

  2. Add one more control in Main Form MenuStrip as Cascade Windows.

     2.gif
     

  3. Double click on Cascade Windows control and write this Code.

        private void cascadeWindowToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.LayoutMdi(System.Windows.Forms.MdiLayout.Cascade);
        }

  4. Debug the application and click on New button two times then two MDI Child form with RichTextBox will open. Now by using Cascade Windows control in the Main Menu you can arrange all the opened Mdi Child Form in Cascade mode.

     3.gif

     4.gif
     

Summary

In this article, we discussed how to arrange MDI Child Form in Cascading mode using Visual Studio 2010 and C#.

Up Next
    Ebook Download
    View all
    Learn
    View all