Shape.BorderColor Property

 

Gets or sets the color of the border of a shape or line control.

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

Syntax

[BrowsableAttribute(true)]
public Color BorderColor { get; set; }
public:
[BrowsableAttribute(true)]
property Color BorderColor {
    Color get();
    void set(Color value);
}
[<BrowsableAttribute(true)>]
member BorderColor : Color with get, set
<BrowsableAttribute(True)>
Public Property BorderColor As Color

Property Value

Type: System.Drawing.Color

A Color structure representing the color of the border of the shape or line. The default is the value of DefaultBorderColor.

Remarks

For a LineShape control, the BorderColor represents the color of the line.

For an OvalShape or RectangleShape control, BorderColor represents the color 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 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);
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)

See Also

Shape Class
Microsoft.VisualBasic.PowerPacks Namespace
How to: Draw Lines with the LineShape Control (Visual Studio)
How to: Draw Shapes with the OvalShape and RectangleShape Controls (Visual Studio)
Introduction to the Line and Shape Controls (Visual Studio)

Return to top