共用方式為


Control.BorderBrush 屬性

定義

取得或設定描述控制項框線背景的筆刷。

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; }
[<System.ComponentModel.Bindable(true)>]
member this.BorderBrush : System.Windows.Media.Brush with get, set
Public Property BorderBrush As Brush

屬性值

Brush

用來填滿控制項框線的筆刷,預設值是 Transparent

屬性

範例

下列範例示範如何設定控制項的框線筆刷屬性。

<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 屬性做為參數的控制項。 在其他控制項上,此屬性不會有任何影響。

相依性屬性資訊

識別碼欄位 BorderBrushProperty
設定為 的中繼資料屬性 true AffectsRender, SubPropertiesDoNotAffectRender

適用於