ToolStrip::Dock Property
Gets or sets which ToolStrip borders are docked to its parent control and determines how a ToolStrip is resized with its parent.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Use the Dock property to define how a ToolStrip is automatically resized as its parent control is resized. For example, setting Dock to Left causes the ToolStrip 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.
If the ToolStrip control is in a ToolStripPanel, the ToolStrip can be repositioned within the ToolStripPanel and across ToolStripPanels. The Dock property is ignored, and if the Stretch property is false, the size of the ToolStrip grows as items are added to the ToolStripPanel. Typically, the ToolStrip does not participate in the tab order.
Note |
|---|
The Anchor and Dock properties are mutually exclusive. Only one can be set at a time, and the last one set takes precedence. |
Available since 2.0
