Control.BorderBrush Control.BorderBrush Control.BorderBrush Control.BorderBrush Property

定義

取得或設定描述控制項框線背景的筆刷。Gets or sets a brush that describes the border background of a control.

public:
 property System::Windows::Media::Brush ^ BorderBrush { System::Windows::Media::Brush ^ get(); void set(System::Windows::Media::Brush ^ value); };
[System.ComponentModel.Bindable(true)]
public System.Windows.Media.Brush BorderBrush { get; set; }
member this.BorderBrush : System.Windows.Media.Brush with get, set
Public Property BorderBrush As Brush

屬性值

用來填滿控制項框線的筆刷,預設值是 TransparentThe brush that is used to fill the control's border; the default is Transparent.

範例

下列範例示範如何設定控制項的框線筆刷屬性。The following example shows how to set the border brush property of a control.

<Button Name="btn6" BorderBrush="Red" 
        Click="ChangeBorderBrush">
  BorderBrush
</Button>
void ChangeBorderBrush(object sender, RoutedEventArgs e)
{
    if (btn6.BorderBrush == Brushes.Red)
    {
        btn6.BorderBrush = Brushes.Black;
        btn6.Content = "Control border brush changes from red to black.";

    }
    else
    {
        btn6.BorderBrush = Brushes.Red;
        btn6.Content = "BorderBrush";
        }
}
Private Sub ChangeBorderBrush(ByVal Sender As Object, ByVal e As RoutedEventArgs)

    If (Equals(btn6.BorderBrush, Brushes.Red)) Then

        btn6.BorderBrush = Brushes.Black
        btn6.Content = "Control border brush changes from red to black."

    Else

        btn6.BorderBrush = Brushes.Red
        btn6.Content = "BorderBrush"
    End If
End Sub

備註

這個屬性只會影響的控制項的範本會使用BorderBrush屬性做為參數。This property only affects a control whose template uses the BorderBrush property as a parameter. 其他控制項,這個屬性會造成任何影響。On other controls, this property has no impact.

相依性屬性資訊Dependency Property Information

識別項欄位Identifier field BorderBrushProperty
若要設定的中繼資料屬性 trueMetadata properties set to true AffectsRenderSubPropertiesDoNotAffectRenderAffectsRender, SubPropertiesDoNotAffectRender

適用於