System.Windows.Forms.Control.Dock Property

Gets or sets which control borders are docked to its parent control and determines how a control is resized with its parent.

Syntax

[System.ComponentModel.DefaultValue(System.Windows.Forms.DockStyle.None)]
[System.ComponentModel.RefreshProperties(System.ComponentModel.RefreshProperties.Repaint)]
[System.ComponentModel.Localizable(true)]
public virtual DockStyle Dock { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

Use the Control.Dock property to define how a control is automatically resized as its parent control is resized. For example, setting Control.Dock to DockStyle.Left causes the control to align itself with the left edges of its parent control and to resize as the parent control is resized. Controls are docked in their Z-order, which is the visual layering of controls on a form along the form's Z-axis (depth).

A control can be docked to one edge of its parent container or can be docked to all edges and fill the parent container.

Setting the Control.Margin property on a docked control has no effect on the distance of the control from the the edges of its container.

Note:

The Control.Anchor and Control.Dock properties are mutually exclusive. Only one can be set at a time, and the last one set takes precedence.

Requirements

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