Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ToolStripItem.Dock Property


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

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public DockStyle Dock { get; set; }

Property Value

Type: System.Windows.Forms.DockStyle

One of the DockStyle values. The default is None.

Exception Condition

The value assigned is not one of the DockStyle values.

This property applies only to flow layouts.

Use the Dock property to define how a ToolStripItem is automatically resized as its parent control is resized. For example, setting Dock to Left causes the ToolStripItem 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.


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

.NET Framework
Available since 2.0
Return to top
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft