Dela via


SimpleShape.BorderWidth Property

Gets or sets the width of the shape control's border.

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

Syntax

'Declaration
Public Overrides Property BorderWidth As Integer
    Get
    Set
public override int BorderWidth { get; set; }
public:
virtual property int BorderWidth {
    int get () override;
    void set (int value) override;
}
abstract BorderWidth : int with get, set
override BorderWidth : int with get, set
override function get BorderWidth () : int
override function set BorderWidth (value : int)

Property Value

Type: System.Int32
An Integer representing the border width in pixels. The default value is 1.

Remarks

For an OvalShape or RectangleShape control, BorderWidth represents the thickness of the outer edges of the shape.

Examples

The following example demonstrates how to set the BorderColor, BorderStyle, and BorderWidth properties for an OvalShape control, displaying an oval that has a red dotted border that is 3 pixels wide.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim OvalShape1 As New OvalShape
    Dim canvas As New ShapeContainer
    ' Set the form as the parent of the ShapeContainer.
    canvas.Parent = Me
    ' Set the ShapeContainer as the parent of the OvalShape.
    OvalShape1.Parent = canvas
    ' Change the color of the border to red.
    OvalShape1.BorderColor = Color.Red
    ' Change the style of the border to dotted.
    OvalShape1.BorderStyle = Drawing2D.DashStyle.Dot
    ' Change the thickness of the border to 3 pixels.
    OvalShape1.BorderWidth = 3
    OvalShape1.Size = New Size(300, 200)
End Sub
private void form1_Load(System.Object sender, System.EventArgs e)
{
    OvalShape ovalShape1 = new OvalShape();
    ShapeContainer canvas = new ShapeContainer();
    // Set the form as the parent of the ShapeContainer.
    canvas.Parent = this;
    // Set the ShapeContainer as the parent of the OvalShape.
    ovalShape1.Parent = canvas;
    // Change the color of the border to red.
    ovalShape1.BorderColor = Color.Red;
    // Change the style of the border to dotted.
    ovalShape1.BorderStyle = System.Drawing.Drawing2D.DashStyle.Dot;
    // Change the thickness of the border to 3 pixels.
    ovalShape1.BorderWidth = 3;
    ovalShape1.Size = new Size(300, 200);
}

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