* 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
2.5 KiB
title, description, ms.date, dev_langs, helpviewer_keywords, ms.assetid, author, ms.author, manager
| title | description | ms.date | dev_langs | helpviewer_keywords | ms.assetid | author | ms.author | manager | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Layer Objects | Learn how to layer objects on Windows Forms controls and child forms to create more complex user interfaces. | 03/30/2017 |
|
|
1acc4281-2976-4715-86f4-bda68134baaf | jillre | jillfra | jillfra |
How to: Layer objects on Windows Forms
When you create a complex user interface, or work with a multiple document interface (MDI) form, you will often want to layer both controls and child forms to create more complex user interfaces (UI). To move and keep track of controls and windows within the context of a group, you manipulate their z-order. Z-order is the visual layering of controls on a form along the form's z-axis (depth). The window at the top of the z-order overlaps all other windows. All other windows overlap the window at the bottom of the z-order.
To layer controls at design time
-
In Visual Studio, select a control that you want to layer.
-
On the Format menu, select Order, and then select Bring To Front or Send To Back.
To layer controls programmatically
Use the xref:System.Windows.Forms.Control.BringToFront%2A and xref:System.Windows.Forms.Control.SendToBack%2A methods to manipulate the z-order of the controls.
For example, if a xref:System.Windows.Forms.TextBox control, txtFirstName, is underneath another control and you want to have it on top, use the following code:
txtFirstName.BringToFront()
txtFirstName.BringToFront();
txtFirstName->BringToFront();
Note
Windows Forms supports control containment. Control containment involves placing a number of controls within a containing control, such as a number of xref:System.Windows.Forms.RadioButton controls within a xref:System.Windows.Forms.GroupBox control. You can then layer the controls within the containing control. Moving the group box moves the controls as well, because they are contained inside it.