共用方式為


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

屬性值

用來標示選取文字的筆刷。

範例

以下範例會建立 並 TextBox 加上文字「This is some text.」範例中將屬性設 SelectionBrush 為紅色,屬性 SelectionOpacity 設為 0.5,以自訂選取文字的外觀。

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

以下插圖展示了 TextBox 前述範例中選取的文字。

帶有紅色 SelectionBrush 將 SelectionBrush 設定為紅色的文字框中選取的文字

備註

你可以透過設定 SelectionBrushSelectionOpacity 屬性來指定用來高亮選取文字的筆刷。 該 SelectionOpacity 性質指定了 的 SelectionBrush不透明度。

適用於