共用方式為


Shape.BorderStyle 屬性

取得或設定形狀或線條控制項的框線樣式。

命名空間:  Microsoft.VisualBasic.PowerPacks
組件:  Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)

語法

'宣告
<BrowsableAttribute(True)> _
Public Property BorderStyle As DashStyle
[BrowsableAttribute(true)]
public DashStyle BorderStyle { get; set; }
[BrowsableAttribute(true)]
public:
property DashStyle BorderStyle {
    DashStyle get ();
    void set (DashStyle value);
}
[<BrowsableAttribute(true)>]
member BorderStyle : DashStyle with get, set
function get BorderStyle () : DashStyle
function set BorderStyle (value : DashStyle)

屬性值

型別:System.Drawing.Drawing2D.DashStyle
A DashStyle值,表示框線的外觀。預設值是 Solid。

例外狀況

例外狀況 條件
InvalidEnumArgumentException

當您設定這個屬性指定的值不是有效的DashStyle的值。

備註

對於LineShape控制項, BorderStyle表示線條的樣式。

對於OvalShapeRectangleShape控制項, BorderStyle代表圖案本身的樣式時BackStyle屬性被設定成Transparent。當BackStyle屬性被設定成Opaque、 BorderStyle代表圖案的外緣的樣式。

範例

下列範例會示範如何設定BorderColor, BorderStyle,以及BorderWidth屬性OvalShape控制項,顯示具有 3 像素寬紅色虛線框線的橢圓形。

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)
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 安全性

請參閱

參考

Shape 類別

Microsoft.VisualBasic.PowerPacks 命名空間

其他資源

HOW TO:使用 LineShape 控制項繪製線條 (Visual Studio)

HOW TO:使用 OvalShape 和 RectangleShape 控制項繪製圖案 (Visual Studio)

Line 和 Shape 控制項簡介 (Visual Studio)