SimpleShape.SetBounds Method (Int32, Int32, Int32, Int32)

 

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)

public void SetBounds(
	int left,
	int top,
	int width,
	int height
)

Parameters

x

The new Left property value of the shape.

y

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.

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

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 void rectangleShape1_Click(System.Object sender, System.EventArgs e)
{
    // Change the Bounds property.
    rectangleShape1.SetBounds(0, 0, 100, 100);
}
Return to top
Show: