次の方法で共有


Form.ClientSize プロパティ

フォームのクライアント領域のサイズを取得または設定します。

Public Shadows Property ClientSize As Size
[C#]
public new Size ClientSize {get; set;}
[C++]
public: __property Size get_ClientSize();public: __property void set_ClientSize(Size);
[JScript]
public hide function get ClientSize() : Size;public hide function set ClientSize(Size);

プロパティ値

フォームのクライアント領域のサイズを表す Size

解説

フォームのクライアント領域のサイズは、フォームから境界線とタイトル バーを除いた部分のサイズです。フォームのクライアント領域は、フォーム内でコントロールを配置できる領域です。このプロパティを使用すると、グラフィック操作を実行する場合やフォーム上のコントロールのサイズおよび位置を変更する場合に適切なサイズを取得できます。フォーム全体のサイズを取得するには、 Size プロパティを使用するか、 Height プロパティと Width プロパティを個別に使用します。

使用例

[Visual Basic, C#, C++] フォームの Resize イベントのイベント ハンドラを作成する例を次に示します。このイベント ハンドラは、フォームの ClientSize プロパティを使用して、button1 という名前の Button コントロールがフォームのクライアント領域全体を占めるようにします。

 
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 'MyForm_Resize

[C#] 
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;
 }
    

[C++] 
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;
 }
    

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET

参照

Form クラス | Form メンバ | System.Windows.Forms 名前空間 | Size | Height | Width