Form.ClientSize 屬性

定義

取得或設定表單工作區的大小。

public:
 property System::Drawing::Size ClientSize { System::Drawing::Size get(); void set(System::Drawing::Size value); };
public System.Drawing.Size ClientSize { get; set; }
member this.ClientSize : System.Drawing.Size with get, set
Public Property ClientSize As Size

屬性值

Size,代表表單工作區的大小。

範例

下列範例會為 Resize 表單的 事件建立事件處理常式。 事件處理常式會 ClientSize 使用表單的 屬性,讓 Button 名為 button1 的控制項填滿表單的整個工作區。

private:
   void MyForm_Resize( Object^ sender, EventHandler^ e )
   {
      // Set the size of button1 to the size of the client area of the form.
      button1->Size = this->ClientSize;
   }
private void MyForm_Resize (Object sender, EventHandler e)
 {
    // Set the size of button1 to the size of the client area of the form.
    button1.Size = this.ClientSize;
 }
Private Sub MyForm_Resize(sender As Object, e As EventHandler)
    ' Set the size of button1 to the size of the client area of the form.
    button1.Size = Me.ClientSize
End Sub

備註

表單的工作區大小是表單的大小,不包括框線和標題列。 表單的工作區是可以放置控制項之表單內的區域。 您可以在執行圖形作業時,或在表單上調整大小和定位控制項時,使用此屬性來取得適當的維度。 若要取得整個表單的大小,請使用 Size 屬性或使用個別屬性 HeightWidth

注意

您目前無法使用應用程式設定系結至此屬性。 如需應用程式設定的詳細資訊,請參閱 應用程式設定概觀

適用於

另請參閱