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 軸 (深度) 。

控制項可以停駐到其父容器的一個邊緣,也可以停駐到所有邊緣並填滿父容器。

適用於