Control.SetClientSizeCore(Int32, Int32) メソッド
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
コントロールのクライアント領域のサイズを設定します。
protected:
virtual void SetClientSizeCore(int x, int y);
C#
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
クライアント領域の幅 (ピクセル単位)。
- y
- Int32
クライアント領域の高さ (ピクセル単位)。
次のコード例では、コントロールが SetClientSizeCore 正方形のままになるようにメソッドをオーバーライドします。 この例では、クラスから直接または間接的に派生するクラスが Control 必要です。
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 );
}
}
C#
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
) の場所まで拡張されます。
通常は、コントロールを ClientSize 設定しないでください。
派生クラスでオーバーライドする SetClientSizeCore(Int32, Int32) 場合は、プロパティが調整されるように基底クラスの SetClientSizeCore(Int32, Int32) メソッドを ClientSize 必ず呼び出してください。
コントロールでの描画の詳細については、「Windows フォーム コントロールのレンダリング」を参照してください。
製品 | バージョン |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8 |
Windows Desktop | 3.0, 3.1, 5, 6, 7 |