次の方法で共有


SimpleShape.ClientRectangle プロパティ

形状のクライアント領域を表す四角形を取得します。

名前空間:  Microsoft.VisualBasic.PowerPacks
アセンブリ:  Microsoft.VisualBasic.PowerPacks.Vs (Microsoft.VisualBasic.PowerPacks.Vs.dll 内)

構文

'宣言
<BrowsableAttribute(False)> _
Public ReadOnly Property ClientRectangle As Rectangle
[BrowsableAttribute(false)]
public Rectangle ClientRectangle { get; }
[BrowsableAttribute(false)]
public:
property Rectangle ClientRectangle {
    Rectangle get ();
}
[<BrowsableAttribute(false)>]
member ClientRectangle : Rectangle with get
function get ClientRectangle () : Rectangle

プロパティ値

型 : Rectangle
A Rectangle (親コントロールを基準にして、ピクセル単位) を表す図形の位置とサイズです。

解説

呼び出すことができます、SetBoundsを変更するメソッド、 ClientRectangle 1 回の操作でのプロパティです。

SimpleShape非クライアント領域を持たない、BoundsとClientRectangleプロパティは同じです。

次の例で使用する方法、DrawToBitmapメソッドおよびClientRectangleプロパティを描画する、OvalShapeの上に、PictureBoxコントロールです。

Private Sub Form1_Load() Handles MyBase.Load
    Dim pic As New System.Drawing.Bitmap(Me.PictureBox1.Image, 
      PictureBox1.Width, PictureBox1.Height)
    Dim rect As New System.Drawing.Rectangle
    ' Assign the client rectangle.
    rect = OvalShape1.ClientRectangle
    ' Draw the oval on the bitmap.
    OvalShape1.DrawToBitmap(pic, rect)
    PictureBox2.Image = pic
End Sub
private void form1_Load(System.Object sender, System.EventArgs e)
{
    System.Drawing.Bitmap pic = new System.Drawing.Bitmap(this.pictureBox1.Image, 
        pictureBox1.Width, pictureBox1.Height);
    System.Drawing.Rectangle rect = new System.Drawing.Rectangle();
    // Assign the client rectangle.
    rect = ovalShape1.ClientRectangle;
    // Draw the oval on the bitmap.
    ovalShape1.DrawToBitmap(pic, rect);
    pictureBox2.Image = pic;
}

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

関連項目

SimpleShape クラス

Microsoft.VisualBasic.PowerPacks 名前空間

その他の技術情報

ライン コントロールとシェイプ コントロールの概要 (Visual Studio)

方法 : LineShape コントロールを使用して線を描画する (Visual Studio)

方法 : OvalShape コントロールおよび RectangleShape コントロールを使用して図形を描画する (Visual Studio)