System.Windows.Forms.AnchorStyles Enumeration

Specifies how a control anchors to the edges of its container.

Syntax

[System.ComponentModel.Editor("System.Windows.Forms.Design.AnchorEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(System.Drawing.Design.UITypeEditor))]
[System.Flags]
public 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 Control.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 System.Windows.Forms.Button has its Control.Anchor property set to AnchorStyles.None and the System.Windows.Forms.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 NameDescription
Bottom

The control is anchored to the bottom edge of its container.

Left

The control is anchored to the left edge of its container.

None

The control is not anchored to any edges of its container.

Right

The control is anchored to the right edge of its container.

Top

The control is anchored to the top edge of its container.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0