SimpleShape.Bounds Property

 

Gets or sets the size and location of the shape in pixels, relative to the parent control.

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

Syntax

[BrowsableAttribute(false)]
public virtual Rectangle Bounds { get; set; }
public:
[BrowsableAttribute(false)]
property Rectangle Bounds {
    virtual Rectangle get();
    virtual void set(Rectangle value);
}
[<BrowsableAttribute(false)>]
abstract Bounds : Rectangle with get, set
[<BrowsableAttribute(false)>]
override Bounds : Rectangle with get, set
<BrowsableAttribute(False)>
Public Overridable Property Bounds As 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 Bounds property in a single operation.

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

Examples

The following example shows how to use the SetBounds method to change the Bounds property of a shape. Specifically, the shape is moved to the upper-left corner of the form and changed to a square. This example requires that you have a RectangleShape control named RectangleShape1 on a form.

private void rectangleShape1_Click(System.Object sender, System.EventArgs e)
{
    // Change the Bounds property.
    rectangleShape1.SetBounds(0, 0, 100, 100);
}
Private Sub RectangleShape1_Click() Handles RectangleShape1.Click
    ' Change the Bounds property.
    RectangleShape1.SetBounds(0, 0, 100, 100)
End Sub

See Also

SimpleShape Class
Microsoft.VisualBasic.PowerPacks Namespace
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)

Return to top