TextBoxBase.SelectionBrush 屬性

定義

取得或設定會反白顯示所選取文字的筆刷。

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

屬性值

Brush

用來反白顯示選取之文字的筆刷。

範例

下列範例會 TextBox 建立 並新增文字「這是一些文字」。 此範例會將 SelectionBrush 屬性設定為紅色,並將 SelectionOpacity 屬性設定為 0.5,以自訂選取文字的外觀。

<TextBox SelectionBrush="Red" SelectionOpacity="0.5"
         Foreground="Blue" CaretBrush="Blue">  
  This is some text.
</TextBox>

下圖顯示上述範例中的 , TextBox 其中已選取其文字。

SelectionBrush 設為紅色的文字方塊
TextBox 中選取的文字,並將 SelectionBrush 設定為紅色

備註

您可以藉由設定 和 SelectionOpacity 屬性,指定醒目提示選取文字的 SelectionBrush 筆刷。 屬性 SelectionOpacity 會指定 的 SelectionBrush 不透明度。

適用於