user1176111
user1176111

Reputation: 121

C# Rich text box highlight

I have a rich text box and a font dialog box. The problem is that when i highlight a certain string or group of strings then open the dialog box, the highlight color disappears. Although the changes are successful (like if i change the font family of a highlighted string it changes). For aesthetic purposes i would like to retain the highlight color, then remove it whenever the changes are done.

THANK YOU for the help!

Upvotes: 1

Views: 1251

Answers (1)

Richard Cox
Richard Cox

Reputation: 501

The rich text box has a property called HideSelection which is true by default. That causes the highlight to disappear when the text box loses focus (as it does when you open the font dialog).

Setting HideSelection to false should cause the highlight to remain.

RichTextBox inherits this property from TextBoxBase:

http://msdn.microsoft.com/en-us/library/system.windows.forms.textboxbase.hideselection.aspx

Upvotes: 5

Related Questions