* 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
3.1 KiB
title, ms.date, helpviewer_keywords, ms.assetid
| title | ms.date | helpviewer_keywords | ms.assetid | ||
|---|---|---|---|---|---|
| How to: Align a Control to the Edges of Forms at Design Time | 03/30/2017 |
|
51f08998-5e3b-4330-be58-a4edd0eb60f4 |
How to: Align a Control to the Edges of Forms at Design Time
You can make your control align to the edge of your forms by setting the value of the xref:System.Windows.Forms.Control.Dock%2A property. This property designates where your control resides in the form. The xref:System.Windows.Forms.Control.Dock%2A property can be set to the following values:
| Setting | Effect on your control |
|---|---|
| xref:System.Windows.Forms.DockStyle.Bottom | Docks to the bottom of the form. |
| xref:System.Windows.Forms.DockStyle.Fill | Fills all remaining space in the form. |
| xref:System.Windows.Forms.DockStyle.Left | Docks to the left side of the form. |
| xref:System.Windows.Forms.DockStyle.None | Does not dock anywhere, and it appears at the location specified by its xref:System.Windows.Forms.Control.Location%2A. |
| xref:System.Windows.Forms.DockStyle.Right | Docks to the right side of the form. |
| xref:System.Windows.Forms.DockStyle.Top | Docks to the top of the form. |
These values can also be set in code. For more information, see How to: Align a Control to the Edges of Forms.
Set the Dock property for your control at design time
-
In the Windows Forms Designer in Visual Studio, select your control.
-
In the Properties window, click the drop-down box next to the xref:System.Windows.Forms.Control.Dock%2A property.
A graphical interface representing the six possible xref:System.Windows.Forms.Control.Dock%2A settings is displayed.
-
Choose the appropriate setting.
-
Your control will now dock in the manner specified by the setting.
See also
- xref:System.Windows.Forms.Control.Dock%2A?displayProperty=nameWithType
- xref:System.Windows.Forms.Control.Anchor%2A?displayProperty=nameWithType
- How to: Align a Control to the Edges of Forms
- Walkthrough: Arranging Controls on Windows Forms Using Snaplines
- How to: Anchor Controls on Windows Forms
- How to: Anchor and Dock Child Controls in a TableLayoutPanel Control
- How to: Anchor and Dock Child Controls in a FlowLayoutPanel Control
- Walkthrough: Arranging Controls on Windows Forms Using a TableLayoutPanel
- Walkthrough: Arranging Controls on Windows Forms Using a FlowLayoutPanel
- Developing Windows Forms Controls at Design Time