【WPF】TextBox的笔刷特效

2019-05-17  本文已影响0人  UnicornChen

  TextBox 控件是我们开发过程中必不可少的组件,它可以使应用程序方便的与用户进行文字交互。

默认情况下TextBox 呈现出以下效果,字体为黑色、选区为蓝色、光标为黑色

一.Selection Brush 属性

1. 字体颜色(Foreground)与选区颜色(SelectionBrush):

<TextBox BorderBrush="Gray" BorderThickness="3" Width="200" Height="30"

        Foreground="Red" SelectionBrush="Green"/>

2. 选区透明度(SelectionOpacity):

<TextBox BorderBrush="Gray" BorderThickness="3" Width="200" Height="30"

          Foreground="Red" SelectionBrush="Green" SelectionOpacity="1"/>

二.Caret Brush 属性

Caret 笔刷可以用来修改光标颜色:

<TextBox BorderBrush="Gray" BorderThickness="3" Width="200" Height="30"

        CaretBrush="Red" />

上一篇 下一篇

猜你喜欢

热点阅读