StatusStrip.Dock Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

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

public override DockStyle Dock { get; set; }

Property Value

Type: System.Windows.Forms.DockStyle

One of the DockStyle values. The default is Bottom.

Use the Dock property to define how a StatusStrip is automatically resized as its parent control is resized. For example, setting Dock to Left causes the StatusStrip 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 following code example demonstrates a StatusStrip with various common properties set, including the Dock property.

statusStrip1.Dock = System.Windows.Forms.DockStyle.Top;
statusStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Visible;
statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
toolStripStatusLabel1});
statusStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow;
statusStrip1.Location = new System.Drawing.Point(0, 0);
statusStrip1.Name = "statusStrip1";
statusStrip1.ShowItemToolTips = true;
statusStrip1.Size = new System.Drawing.Size(292, 22);
statusStrip1.SizingGrip = false;
statusStrip1.Stretch = false;
statusStrip1.TabIndex = 0;
statusStrip1.Text = "statusStrip1";

.NET Framework
Available since 2.0
Return to top
Show: