WPF 4 textbox brush Effects

Source: Internet
Author: User

Textbox Control is an essential component in our development process. It can make the applicationProgramFacilitate text interaction with users. Two new paint effects are added to textbox in new WPF 4:Selection,CaretAnd use these two special effects to make textbox more beautiful.

By default, textbox displays the following effects: the font is black, the selection is blue, and the cursor is Black:

 
<TextboxBorderbrush= "Gray"Borderthickness= "3"Width= "200"Height= "30"/>

 

Selection brush attributes

1. Font color (Foreground) And selection color (Selectionbrush):

<TextboxBorderbrush= "Gray"Borderthickness= "3"Width= "200"Height= "30"Foreground= "Red"Selectionbrush= "Green"/>

2. Selection transparency (Selectionopacity):

 <TextboxBorderbrush= "Gray"Borderthickness= "3"Width= "200"Height= "30"Foreground= "Red"Selectionbrush= "Green"Selectionopacity= "1"/>

3. Gradient selection effect:

 <  Textbox  Borderbrush = "Gray"  Borderthickness  = "3"  Width  = "200"  Height  = "30"> <  Textbox. selectionbrush  > <  Lineargradientbrush  Startpoint  = "0, 0"  Endpoint  = "1, 1"> <  Gradientstop  Color = "Red"  Offset  = "0"/> <  Gradientstop  Color  = "Yellow"  Offset  = "0.2"/> <  Gradientstop  Color  = "Blue"  Offset  = "0.4"/> <  Gradientstop  Color  = "Green"  Offset = "0.6"/> <  Gradientstop  Color  = "Orchid"  Offset  = "0.8"/> <  Gradientstop  Color  = "Pink"  Offset  = "1"/> </  Lineargradientbrush  > </  Textbox. selectionbrush  > </  Textbox > 


Caret brush attributes

The caret brush can be used to modify the cursor color:

 
<TextboxBorderbrush= "Gray"Borderthickness= "3"Width= "200"Height= "30"Caretbrush= "Red"/>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.