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

'Declaration
<BrowsableAttribute(False)> _
Public Overridable Property Bounds As Rectangle
[BrowsableAttribute(false)]
public virtual Rectangle Bounds { get; set; }
[BrowsableAttribute(false)]
public:
virtual property Rectangle Bounds {
    Rectangle get ();
    void set (Rectangle value);
}
[<BrowsableAttribute(false)>]
abstract Bounds : Rectangle with get, set
[<BrowsableAttribute(false)>]
override Bounds : Rectangle with get, set
function get Bounds () : Rectangle 
function set Bounds (value : 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 Sub RectangleShape1_Click() Handles RectangleShape1.Click
    ' Change the Bounds property.
    RectangleShape1.SetBounds(0, 0, 100, 100)
End Sub
private void rectangleShape1_Click(System.Object sender, System.EventArgs e)
{
    // Change the Bounds property.
    rectangleShape1.SetBounds(0, 0, 100, 100);
}

.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)