SimpleShape.SetBounds Method

Sets the bounds of the shape to the specified location and size.

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

Syntax

'Declaration
Public Sub SetBounds ( _
    x As Integer, _
    y As Integer, _
    width As Integer, _
    height As Integer _
)
'Usage
Dim instance As SimpleShape 
Dim x As Integer 
Dim y As Integer 
Dim width As Integer 
Dim height As Integer

instance.SetBounds(x, y, width, height)
public void SetBounds(
    int x,
    int y,
    int width,
    int height
)
public:
void SetBounds(
    int x, 
    int y, 
    int width, 
    int height
)
public function SetBounds(
    x : int, 
    y : int, 
    width : int, 
    height : int
)

Parameters

  • x
    Type: System.Int32

    The new Left property value of the shape.

  • y
    Type: System.Int32

    The new Top property value of the shape.

  • width
    Type: System.Int32

    The new Width property value of the shape.

  • height
    Type: System.Int32

    The new Height property value of the shape.

Remarks

You can use the SetBounds method to change a shape's size and location in a single statement.

Examples

The following example shows how to use the SetBounds method to change the size and location 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(ByVal sender As System.Object, _
 ByVal e As System.EventArgs) 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

SimpleShape Members

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)

and RectangleShape Controls