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)
Syntax
public void SetBounds(
int left,
int top,
int width,
int height
)
public:
void SetBounds(
int left,
int top,
int width,
int height
)
member SetBounds :
left:int *
top:int *
width:int *
height:int -> unit
Public Sub SetBounds (
left As Integer,
top As Integer,
width As Integer,
height As Integer
)
Parameters
- x
The new Left property value of the shape.
- y
The new Top property value of the shape.
width
Type: System.Int32The new Width property value of the shape.
height
Type: System.Int32The 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 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)
3470d91f-a61e-415f-9e88-a27c07ba2b5e
Return to top