---
title: "How to: Arrange MDI Child Forms"
ms.date: "03/30/2017"
dev_langs: 
  - "csharp"
  - "vb"
helpviewer_keywords: 
  - "child forms [Windows Forms], arranging"
  - "MDI [Windows Forms], arranging child forms"
ms.assetid: a0786378-3206-4ccc-898e-7d3b38cc5089
---
# How to: Arrange MDI Child Forms
Often, applications will have menu commands for actions such as Tile, Cascade, and Arrange, which control the layout of the open MDI child forms. You can use the <xref:System.Windows.Forms.Form.LayoutMdi%2A> method with one of the <xref:System.Windows.Forms.MdiLayout> enumeration values to rearrange the child forms in an MDI parent form.  
  
 The <xref:System.Windows.Forms.MdiLayout> enumeration values display child forms as cascading, as horizontally or vertically tiled, or as child form icons arranged along the lower portion of the MDI form. These values have the same effect as the Windows commands **Cascade windows**, **Show windows side by side**, **Show windows stacked**, and **Show the desktop**, respectively.  
  
 Often, these methods are used as the event handlers called by a menu item's <xref:System.Windows.Forms.Control.Click> event. In this way, a menu item with the text "Cascade Windows" can have the desired effect on the MDI child windows.  
  
### To arrange child forms  
  
1. In a method, use the <xref:System.Windows.Forms.Form.LayoutMdi%2A> method to set the <xref:System.Windows.Forms.MdiLayout> enumeration for the MDI parent form. The following example uses the <xref:System.Windows.Forms.MdiLayout.Cascade?displayProperty=nameWithType> enumeration value for the child windows of the MDI parent form (`Form1`). The enumeration is used in code during the event handler for the <xref:System.Windows.Forms.Control.Click> event of the **Cascade Windows** menu item.  
  
    ```vb  
    Protected Sub CascadeWindows_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)  
       Me.LayoutMdi(System.Windows.Forms.MdiLayout.Cascade)  
    End Sub  
    ```  
  
    ```csharp  
    protected void CascadeWindows_Click(object sender, System.EventArgs e){  
       this.LayoutMdi(System.Windows.Forms.MdiLayout.Cascade);  
    }  
    ```  
  
    > [!NOTE]
    > You can also tile windows and arranging windows as icons by changing the <xref:System.Windows.Forms.MdiLayout> enumeration value used.  
  
2. If you’re using Visual C#, place the following code in the form's constructor to register the event handler.  
  
    ```csharp  
    this.button1.Click += new System.EventHandler(this.button1_Click);  
    ```  
  
## See also

- [Multiple-Document Interface (MDI) Applications](multiple-document-interface-mdi-applications.md)
- [How to: Create MDI Parent Forms](how-to-create-mdi-parent-forms.md)
- [How to: Create MDI Child Forms](how-to-create-mdi-child-forms.md)
- [How to: Determine the Active MDI Child](how-to-determine-the-active-mdi-child.md)
- [How to: Send Data to the Active MDI Child](how-to-send-data-to-the-active-mdi-child.md)
