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)
屬性值
類型:Int32
表示半徑的 Integer。預設為 0 或無半徑。
備註
CornerRadius 的最小值為 0。 這會導致矩形或方格,沒有圓角。 最大值是高度或寬度 (以較小的兩個刪除) 的 RectangleShape 。 對於方形會產生圓形。
範例
當按一下 RectangleShape 時,下列範例會將 RectangleShape 的 CornerRadius 。 這個範例要求您的表單必須有一個名為 RectangleShape1 的 RectangleShape 。
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 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。
請參閱
參考
Microsoft.VisualBasic.PowerPacks 命名空間
其他資源
Line 和 Shape 控制項簡介 (Visual Studio)