Share via


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)

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public Property Width As Integer
    Get
    Set
[BrowsableAttribute(false)]
public int Width { get; set; }
[BrowsableAttribute(false)]
public:
property int Width {
    int get ();
    void set (int value);
}
[<BrowsableAttribute(false)>]
member Width : int with get, set
function get Width () : int
function set Width (value : int)

Property Value

Type: System.Int32
The width of the shape in pixels.

Remarks

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.

Examples

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 Sub OvalShape1_Click() Handles OvalShape1.Click
    ' 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
End Sub
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;
}

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