Control.SetClientSizeCore(Int32, Int32) メソッド
定義
コントロールのクライアント領域のサイズを設定します。Sets the size of the client area of the control.
protected:
virtual void SetClientSizeCore(int x, int y);
protected virtual void SetClientSizeCore (int x, int y);
abstract member SetClientSizeCore : int * int -> unit
override this.SetClientSizeCore : int * int -> unit
Protected Overridable Sub SetClientSizeCore (x As Integer, y As Integer)
パラメーター
- x
- Int32
クライアント領域の幅 (ピクセル単位)。The client area width, in pixels.
- y
- Int32
クライアント領域の高さ (ピクセル単位)。The client area height, in pixels.
例
次のコード例では、メソッドをオーバーライドし SetClientSizeCore て、コントロールが正方形のままであることを確認します。The following code example overrides the SetClientSizeCore method to ensure that the control remains square. この例では、クラスから直接または間接的に派生したクラスが必要です Control 。This example requires that you have a class that is either directly or indirectly derived from the Control class.
protected:
virtual void SetClientSizeCore( int x, int y ) override
{
// Keep the client size square.
if ( x > y )
{
UserControl::SetClientSizeCore( x, x );
}
else
{
UserControl::SetClientSizeCore( y, y );
}
}
protected override void SetClientSizeCore(int x, int y)
{
// Keep the client size square.
if(x > y)
{
base.SetClientSizeCore(x, x);
}
else
{
base.SetClientSizeCore(y, y);
}
}
Protected Overrides Sub SetClientSizeCore(x As Integer, y As Integer)
' Keep the client size square.
If x > y Then
MyBase.SetClientSizeCore(x, x)
Else
MyBase.SetClientSizeCore(y, y)
End If
End Sub
注釈
クライアント領域は、(0, 0) の場所から始まり、(,) の場所まで拡張され x
y
ます。The client area starts at the (0, 0) location and extends to the (x
, y
) location.
通常、コントロールのを設定する必要はありません ClientSize 。Typically, you should not set the ClientSize of the control.
注意 (継承者)
派生クラスでをオーバーライドする場合は、 SetClientSizeCore(Int32, Int32) SetClientSizeCore(Int32, Int32) プロパティが調整されるように、基本クラスのメソッドを呼び出す必要があり ClientSize ます。When overriding SetClientSizeCore(Int32, Int32) in a derived class, be sure to call the base class's SetClientSizeCore(Int32, Int32) method so that the ClientSize property is adjusted.
コントロールの描画の詳細については、「 Windows フォームコントロールのレンダリング」を参照してください。For more information about drawing on controls, see Rendering a Windows Forms Control.