編輯

共用方式為


Border.CornerRadius Property

Definition

Gets or sets a value that represents the degree to which the corners of a Border are rounded.

public:
 property System::Windows::CornerRadius CornerRadius { System::Windows::CornerRadius get(); void set(System::Windows::CornerRadius value); };
public System.Windows.CornerRadius CornerRadius { get; set; }
member this.CornerRadius : System.Windows.CornerRadius with get, set
Public Property CornerRadius As CornerRadius

Property Value

The CornerRadius that describes the degree to which corners are rounded. This property has no default value.

Examples

The following example shows how to set the value of this property.

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

Although the property name suggests that you can use only singular values, CornerRadius also supports non-uniform radii. Radius values that are too large are scaled so that they blend smoothly from corner to corner.

Dependency Property Information

Item Value
Identifier field CornerRadiusProperty
Metadata properties set to true AffectsMeasure, AffectsRender

Applies to

See also