StatusStrip.Dock 属性

定义

获取或设置要停靠在其父控件上的 StatusStrip 边框,并确定 StatusStrip 如何随其父控件一起调整大小。

public:
 virtual property System::Windows::Forms::DockStyle Dock { System::Windows::Forms::DockStyle get(); void set(System::Windows::Forms::DockStyle value); };
public override System.Windows.Forms.DockStyle Dock { get; set; }
member this.Dock : System.Windows.Forms.DockStyle with get, set
Public Overrides Property Dock As DockStyle

属性值

DockStyle

DockStyle 值之一。 默认值为 Bottom

示例

下面的代码示例演示了一个 StatusStrip 具有各种通用属性集,包括该 Dock 属性。

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";
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"

注解

使用 Dock 属性定义如何 StatusStrip 自动调整其父控件的大小。 例如,设置为DockLeft使StatusStrip自身与其父控件的左边缘对齐,并在调整父控件大小时调整大小。 控件按 Z 顺序停靠,它是窗体上控件沿窗体的 Z 轴 (深度) 的视觉分层。

控件可以停靠到其父容器的一个边缘,也可以停靠到所有边缘并填充父容器。

适用于