Muokkaa

Jaa


CornerRadius Struct

Definition

Represents the radiuses 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>
[<System.ComponentModel.TypeConverter(typeof(System.Windows.CornerRadiusConverter))>]
type CornerRadius = struct
Public Structure CornerRadius
Implements IEquatable(Of CornerRadius)
Inheritance
CornerRadius
Attributes
Implements

Examples

The following example shows how to set the value of the CornerRadius property by using 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">

Remarks

This class has four properties, TopLeft, TopRight, BottomLeft, and BottomRight, corresponding to the individual corners of the rectangle. Each is a Double structure that can be set independently of the others.

The radiuses cannot be negative.

XAML Attribute Usage

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

-or-

<object property="AllCorners"/>  

XAML Values

TopLeft
Double value that specifies the radius of the top left corner.

TopRight
Double value that specifies the top right corner.

BottomRight
Double value that specifies the bottom right corner.

BottomLeft
Double value that specifies the bottom left corner.

AllCorners
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.

Note

Values need not include the decimal point explicitly when specified as a string. The string "1" provided in XAML evaluates to a value of 1.0 when referenced in code.

Constructors

CornerRadius(Double, Double, Double, Double)

Initializes a new instance of the CornerRadius class with the specified radius values for each corner of the rectangle.

CornerRadius(Double)

Initializes a new instance of the CornerRadius class with a specified uniform radius value for every corner or the rectangle.

Properties

BottomLeft

Gets or sets the radius of the bottom-left corner.

BottomRight

Gets or sets the radius of the bottom-right corner.

TopLeft

Gets or sets the radius of the top-left corner.

TopRight

Gets or sets the radius of the top-right corner.

Methods

Equals(CornerRadius)

Compares two CornerRadius structures for equality.

Equals(Object)

Determines whether the specified Object is a CornerRadius and whether it contains the same corner radius values as this CornerRadius.

GetHashCode()

Returns the hash code for this CornerRadius.

ToString()

Returns the string representation of the CornerRadius.

Operators

Equality(CornerRadius, CornerRadius)

Compares two CornerRadius structures for equality.

Inequality(CornerRadius, CornerRadius)

Compares two CornerRadius structures for inequality.

Applies to

See also