CornerRadius CornerRadius CornerRadius CornerRadius Struct

定義

表示矩形邊角的半徑。Represents the radii of a rectangle's corners.

public value class CornerRadius : IEquatable<System::Windows::CornerRadius>
[System.ComponentModel.TypeConverter(typeof(System.Windows.CornerRadiusConverter))]
public struct CornerRadius : IEquatable<System.Windows.CornerRadius>
type CornerRadius = struct
Public Structure CornerRadius
Implements IEquatable(Of CornerRadius)
繼承
CornerRadiusCornerRadiusCornerRadiusCornerRadius
屬性
實作

範例

下列範例顯示如何使用CornerRadius Extensible Application Markup Language (XAML)Extensible Application Markup Language (XAML)和程式碼來設定屬性的值。The following example shows how to set the value of the CornerRadius property by using Extensible Application Markup Language (XAML)Extensible Application Markup Language (XAML) and code.

myBorder1 = new Border();
myBorder1.BorderBrush = Brushes.SlateBlue;
myBorder1.BorderThickness = new Thickness(5, 10, 15, 20);
myBorder1.Background = Brushes.AliceBlue;
myBorder1.Padding = new Thickness(5);
myBorder1.CornerRadius = new CornerRadius(15);
Dim myBorder1 As New Border()
myBorder1.BorderBrush = Brushes.SlateBlue
myBorder1.BorderThickness = New Thickness(5, 10, 15, 20)
myBorder1.Background = Brushes.AliceBlue
myBorder1.Padding = New Thickness(5)
myBorder1.CornerRadius = New CornerRadius(15)
<Border BorderBrush="SlateBlue" BorderThickness="5,10,15,20" Background="AliceBlue" Padding="5" CornerRadius="15">

備註

這個類別有四個屬性TopLeft: TopRightBottomLeft、和BottomRight, 對應于矩形的各個角落。This class has four properties, TopLeft, TopRight, BottomLeft, and BottomRight, corresponding to the individual corners of the rectangle. 每個都Double是可以獨立設定的結構。Each is a Double structure that can be set independently of the others.

半徑不可以是負數。The radii cannot be negative.

XAML Attribute UsageXAML Attribute Usage

<object property="TopLeft,TopRight,BottomRight,BottomLeft "/>  

-或--or-

<object property="AllCorners"/>  

XAML 值XAML Values

TopLeftTopLeft
Double指定左上角半徑的值。Double value that specifies the radius of the top left corner.

TopRightTopRight
Double指定右上角的值。Double value that specifies the top right corner.

BottomRightBottomRight
Double指定右下角的值。Double value that specifies the bottom right corner.

BottomLeftBottomLeft
Double指定左下角的值。Double value that specifies the bottom left corner.

AllCornersAllCorners
如果只指定單一Double值, 該量值就會套用至的所有TopLeft右上CornerRadius BottomRightBottomLeft角落。If only a single Double value is specified, that measure is applied to ALL of the TopLeft, TopRight, BottomRight, and BottomLeft corners of the CornerRadius.

注意

當指定為字串時, 值不需要明確包含小數點。Values need not include the decimal point explicitly when specified as a string. 在程式碼中參考時, XAMLXAML在中提供的字串 "1" 會評估為1.0 的值。The string "1" provided in XAMLXAML evaluates to a value of 1.0 when referenced in code.

建構函式

CornerRadius(Double) CornerRadius(Double) CornerRadius(Double) CornerRadius(Double)

使用各個邊角或矩形指定的統一半徑值初始化 CornerRadius 類別的新執行個體。Initializes a new instance of the CornerRadius class with a specified uniform radius value for every corner or the rectangle.

CornerRadius(Double, Double, Double, Double) CornerRadius(Double, Double, Double, Double) CornerRadius(Double, Double, Double, Double) CornerRadius(Double, Double, Double, Double)

使用矩形各個邊角的指定半徑值初始化 CornerRadius 類別的新執行個體。Initializes a new instance of the CornerRadius class with the specified radius values for each corner of the rectangle.

屬性

BottomLeft BottomLeft BottomLeft BottomLeft

取得或設定左下角的半徑。Gets or sets the radius of the bottom-left corner.

BottomRight BottomRight BottomRight BottomRight

取得或設定右下角的半徑。Gets or sets the radius of the bottom-right corner.

TopLeft TopLeft TopLeft TopLeft

取得或設定左上角的半徑。Gets or sets the radius of the top-left corner.

TopRight TopRight TopRight TopRight

取得或設定右上角的半徑。Gets or sets the radius of the top-right corner.

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的 Object 是否為 CornerRadius,以及它包含的邊角半徑是否與這個 CornerRadius 相同。Determines whether the specified Object is a CornerRadius and whether it contains the same corner radius values as this CornerRadius.

Equals(CornerRadius) Equals(CornerRadius) Equals(CornerRadius) Equals(CornerRadius)

比較兩個 CornerRadius 結構是否相等。Compares two CornerRadius structures for equality.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

傳回這個 CornerRadius 的雜湊程式碼。Returns the hash code for this CornerRadius.

ToString() ToString() ToString() ToString()

傳回 CornerRadius 的字串表示。Returns the string representation of the CornerRadius.

運算子

Equality(CornerRadius, CornerRadius) Equality(CornerRadius, CornerRadius) Equality(CornerRadius, CornerRadius) Equality(CornerRadius, CornerRadius)

比較兩個 CornerRadius 結構是否相等。Compares two CornerRadius structures for equality.

Inequality(CornerRadius, CornerRadius) Inequality(CornerRadius, CornerRadius) Inequality(CornerRadius, CornerRadius) Inequality(CornerRadius, CornerRadius)

比較兩個 CornerRadius 結構是否相等。Compares two CornerRadius structures for inequality.

適用於

另請參閱