共用方式為


RectangleShape.CornerRadius 屬性

取得或設定圓角的矩形和圓角正方形的圓角半徑。

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

語法

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

屬性值

型別:System.Int32
Integer 代表半徑。預設值為 0 或無半徑。

備註

最小值為CornerRadius為 0。這會導致矩形或正方形,而不需圓角。最大值是高度或寬度 (兩者間較小的) RectangleShape除以二。為正方形,這樣會建立一個圓圈。

範例

下列範例變更CornerRadius的RectangleShapeRectangleShape在按下。這個範例要求您必須RectangleShape的表單上命名為 RectangleShape1。

Private Sub RectangleShape1_Click(ByVal sender As System.Object,
 ByVal e As System.EventArgs) Handles RectangleShape1.Click
    Dim max As Integer
    ' Calculate the maximum radius.
    max = Math.Min(RectangleShape1.Height, RectangleShape1.Width) / 2
    ' Check whether the maximum radius has been reached.
    If RectangleShape1.CornerRadius = max Then
        ' Reset the radius to 0.
        RectangleShape1.CornerRadius = 0
    Else
        ' Increase the radius.
        RectangleShape1.CornerRadius =
          RectangleShape1.CornerRadius + 15
    End If
End Sub
private void rectangleShape1_Click(System.Object sender, System.EventArgs e)
{
    int max;
    // Calculate the maximum radius.
    max = Math.Min(rectangleShape1.Height, rectangleShape1.Width) / 2;
    // Check whether the maximum radius has been reached.
    if (rectangleShape1.CornerRadius == max)
    // Reset the radius to 0.
    {
        rectangleShape1.CornerRadius = 0;
    }
    else
    {
        // Increase the radius.
        rectangleShape1.CornerRadius = rectangleShape1.CornerRadius + 15;
    }
}

.NET Framework 安全性

請參閱

參考

RectangleShape 類別

Microsoft.VisualBasic.PowerPacks 命名空間

其他資源

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

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

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