共用方式為


Shape.BorderWidth 屬性

取得或設定線條或圖形控制項的框線寬度。

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

語法

'宣告
<BrowsableAttribute(True)> _
Public Overridable Property BorderWidth As Integer
[BrowsableAttribute(true)]
public virtual int BorderWidth { get; set; }
[BrowsableAttribute(true)]
public:
virtual property int BorderWidth {
    int get ();
    void set (int value);
}
[<BrowsableAttribute(true)>]
abstract BorderWidth : int with get, set
[<BrowsableAttribute(true)>]
override BorderWidth : int with get, set
function get BorderWidth () : int 
function set BorderWidth (value : int)

屬性值

類型:Int32
Integer 代表像素為單位的框線寬度。預設值為 1。

備註

針對LineShape控制項,BorderWidth表示線條的粗細。

針對OvalShapeRectangleShape控制項,BorderWidth代表圖形的外緣粗細。

範例

下列範例示範如何設定BorderColorBorderStyle,和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 命名空間

其他資源

如何:使用 LineShape 控制項繪製線條 (Visual Studio)

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

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