共用方式為


TextBoxBase.SelectionOpacity 屬性

定義

取得或設定 的不透明度 SelectionBrush

public:
 property double SelectionOpacity { double get(); void set(double value); };
public double SelectionOpacity { get; set; }
member this.SelectionOpacity : double with get, set
Public Property SelectionOpacity As Double

屬性值

該 的不透明度 SelectionBrush。 預設值為 0.4。

範例

以下範例會建立 並 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 在選擇不透明度設為 0.5 的文字框中選取的文字

備註

SelectionOpacity 設為 0,則為 SelectionBrush 透明且不可見。 若 SelectionOpacity 設定為 1.0 或以上,則 SelectionBrush 為不透明,選取的文字不可見。

適用於