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">

備註

這個類別有四個屬性, TopLeftTopRightBottomLeft,和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右上BottomRight,以及BottomLeft角落CornerRadiusIf 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. 字串"1"中提供XAMLXAML評估為 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.

適用於

另請參閱