SimpleShape.Width Property


Gets or sets the width of the shape.

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

public int Width { get; set; }

Property Value

Type: System.Int32

The width of the shape in pixels.

Changes made to the Width and Left property values cause the Right property value of the shape to change.

You can use the Size property to change both the Height and the Width properties, or use the SetBounds method to change a shape's size and location in a single statement.

The following example shows how to use the Height and Width properties to change the size of a shape. This example requires that you have an OvalShape control named OvalShape1 on a form.

private void ovalShape1_Click(System.Object sender, System.EventArgs e)
    // Set the height.
    ovalShape1.Height = ovalShape1.Height + 50;
    // Set the width the same as the height to make it a circle.
    ovalShape1.Width = ovalShape1.Height;
Return to top