SimpleShape.ClientRectangle Property

Gets the rectangle that represents the client area of the shape.

Namespace:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

Syntax

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

Property Value

Type: System.Drawing.Rectangle
A Rectangle in pixels, relative to the parent control, that represents the size and location of the shape.

Remarks

You can call the SetBounds method to change the ClientRectangle property in a single operation.

Because SimpleShape has no non-client area, the Bounds and ClientRectangle properties are the same.

Examples

The following example demonstrates how to use the DrawToBitmap method and the ClientRectangle property to draw an OvalShape on top of a PictureBox control.

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 Security

See Also

Reference

SimpleShape Class

Microsoft.VisualBasic.PowerPacks Namespace

Other Resources

Introduction to the Line and Shape Controls (Visual Studio)

How to: Draw Lines with the LineShape Control (Visual Studio)

How to: Draw Shapes with the OvalShape and RectangleShape Controls (Visual Studio)