Control.ClientRectangle プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)


コントロールのクライアント領域とは、コントロールの範囲から、スクロール バー、境界線、タイトル バー、メニューなどのクライアント以外の要素を除いた部分です。
クライアント座標は、コントロールのクライアント領域の左上隅に対する相対座標であるため、このプロパティによって返される四角形の左上隅の座標は (0,0) となります。このプロパティを使用して、コントロールの表面の描画などのタスクに対して、コントロールのクライアント領域のサイズと座標を取得できます。

フォームでの自動スクロール機能を有効にしてそのフォームのサイズを変更し、サイズ変更した後もボタンが非表示にならないようにするコード例を次に示します。この例では、button2 という名前の Button が配置された Form が存在している必要があります。
Private Sub ResizeForm() ' Enable auto-scrolling for the form. Me.AutoScroll = True ' Resize the form. Dim r As Rectangle = Me.ClientRectangle ' Subtract 100 pixels from each side of the Rectangle. r.Inflate(- 100, - 100) Me.Bounds = Me.RectangleToScreen(r) ' Make sure button2 is visible. Me.ScrollControlIntoView(button2) End Sub
private void ResizeForm() { // Enable auto-scrolling for the form. this.AutoScroll = true; // Resize the form. Rectangle r = this.ClientRectangle; // Subtract 100 pixels from each side of the Rectangle. r.Inflate(-100, -100); this.Bounds = this.RectangleToScreen(r); // Make sure button2 is visible. this.ScrollControlIntoView(button2); }
private: void ResizeForm() { // Enable auto-scrolling for the form. this->AutoScroll = true; // Resize the form. Rectangle r = this->ClientRectangle; // Subtract 100 pixels from each side of the Rectangle. r.Inflate( -100, -100 ); this->Bounds = this->RectangleToScreen( r ); // Make sure button2 is visible. this->ScrollControlIntoView( button2 ); }
private void ResizeForm() { // Enable auto-scrolling for the form. this.set_AutoScroll(true); // Resize the form. Rectangle r = this.get_ClientRectangle(); // Subtract 100 pixels from each side of the Rectangle. r.Inflate(-100, -100); this.set_Bounds(this.RectangleToScreen(r)); // Make sure button2 is visible. this.ScrollControlIntoView(button2); } //ResizeForm

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からControl.ClientRectangle プロパティを検索する場合は、下記のリンクをクリックしてください。

- Control.ClientRectangle プロパティのページへのリンク