Shape.BorderStyle Property

 

Gets or sets the border style for a shape or line control.

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

[BrowsableAttribute(true)]
public DashStyle BorderStyle { get; set; }

Property Value

Type: System.Drawing.Drawing2D.DashStyle

A DashStyle value that represents the appearance of the border. The default value is Solid.

Exception Condition
InvalidEnumArgumentException

The specified value when you set this property is not a valid DashStyle value.

For a LineShape control, BorderStyle represents the style of the line.

For an OvalShape or RectangleShape control, BorderStyle represents the style of the shape itself when the BackStyle property is set to Transparent. When the BackStyle property is set to Opaque, the BorderStyle represents the style of the outer edges of the shape.

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

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);
Return to top
Show: