TextBoxBase.SelectionBrush 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定用來高亮選取文字的筆刷。
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 和 SelectionOpacity 屬性來指定用來高亮選取文字的筆刷。 該 SelectionOpacity 性質指定了 的 SelectionBrush不透明度。