SimpleShape.BorderWidth 属性

获取或设置 shape 控件的边框的宽度。

命名空间:  Microsoft.VisualBasic.PowerPacks
程序集:  Microsoft.VisualBasic.PowerPacks.Vs(在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)

语法

声明
Public Overrides Property BorderWidth As Integer
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)

属性值

类型:System.Int32
表示在像素的 Integer 边框宽度。默认值为 1。

备注

OvalShapeRectangleShape 控件, BorderWidth 表示形状的外边缘的粗细。

示例

下面的示例演示如何设置 BorderColorBorderStyle和 BorderWidth 属性 OvalShape 控件,演示了一个红色虚线边框宽 3 像素的椭圆形。

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

请参见

参考

SimpleShape 类

Microsoft.VisualBasic.PowerPacks 命名空间

其他资源

Line 和 Shape 控件简介 (Visual Studio)

如何:使用 LineShape 控件绘制直线 (Visual Studio)

如何:使用 OvalShape 和 RectangleShape 控件绘制形状 (Visual Studio)