Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TextBox - Can I keep the selection highlight when it loses focus?

I would like to have a regular TextBox on my form, where the selected text is still highlighted even if you use another control, e.g. push a button.

Does anyone know a way to achieve this (without using a RichTextBox which is not suitable for what I am doing).

like image 803
Martin Avatar asked May 27 '10 12:05

Martin


2 Answers

Sounds like you are looking for the HideSelection property:

Gets or sets a value indicating whether the selected text in the text box control remains highlighted when the control loses focus.

like image 60
tanascius Avatar answered Sep 16 '22 15:09

tanascius


The HideSelection property is your friend. Set it to false and you should get what you are looking for. I never quite understood why the default is true.

like image 31
Fredrik Mörk Avatar answered Sep 17 '22 15:09

Fredrik Mörk