Files
Andy De George c0ba284473 Initial winforms content migrated (#18)
* Merge winforms framework content to working branch (#14)

* Breadcrumb / TOC / Move net5 to net folder (#15)

* change path from net5 to net

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Add .net 5 winforms placeholder article (#16)

* added some metadata and adjusted net5 placeholder

* corrections

* corrections

* corrections

* Test1

* Swapping landing page vs concept

* fix links

* Fix links

* Fix desc
2020-09-01 16:26:21 -07:00

2.9 KiB
Raw Permalink Blame History

title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
title ms.date dev_langs helpviewer_keywords ms.assetid
How to: Arrange MDI Child Forms 03/30/2017
csharp
vb
child forms [Windows Forms], arranging
MDI [Windows Forms], arranging child forms
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.

    Protected Sub CascadeWindows_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)  
       Me.LayoutMdi(System.Windows.Forms.MdiLayout.Cascade)  
    End Sub  
    
    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 youre using Visual C#, place the following code in the form's constructor to register the event handler.

    this.button1.Click += new System.EventHandler(this.button1_Click);  
    

See also