AnchorStyles Enumeration
Specifies how a control anchors to the edges of its container.
This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.
[Visual Basic] <Flags> <Serializable> Public Enum AnchorStyles [C#] [Flags] [Serializable] public enum AnchorStyles [C++] [Flags] [Serializable] __value public enum AnchorStyles [JScript] public Flags Serializable enum AnchorStyles
Remarks
When a control is anchored to an edge of its container, the distance between the control and the specified edge remains constant when the container resizes. For example, if a control is anchored to the right edge of its container, the distance between the right edge of the control and the right edge of the container remains constant when the container resizes. A control can be anchored to any combination of control edges. If the control is anchored to opposite edges of its container (for example, to the top and bottom), it resizes when the container resizes. If a control has its Anchor property set to AnchorStyles.None, the control moves half of the distance that the container of the control is resized. For example, if a Button has its Anchor property set to AnchorStyles.None and the Form that the control is located on is resized by 20 pixels in either direction, the button will be moved 10 pixels in both directions.
Members
| Member name | Description | Value |
|---|---|---|
| Bottom | The control is anchored to the bottom edge of its container. | 2 |
| Left | The control is anchored to the left edge of its container. | 4 |
| None | The control is not anchored to any edges of its container. | 0 |
| Right | The control is anchored to the right edge of its container. | 8 |
| Top | The control is anchored to the top edge of its container. | 1 |
Requirements
Namespace: System.Windows.Forms
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)