user1908746
user1908746

Reputation:

Get the format of a char in a CRichEditCtrl (or RichTextBox) without selecting it

Either C++ or C# solutions are welcome.

I have the index of a character in a text displayed in a RichEditCtrl. I need to know its format (is it bold, red, etc) without selecting it.

Thank you all.

Upvotes: 0

Views: 279

Answers (1)

Joseph Willcoxson
Joseph Willcoxson

Reputation: 6040

Using the base CRichEditCtrl, there is no way to get the format of a char without selecting it. If you don't want to change the selection, then save the start/end position of the current selection, select the character you want the format of, call CRichEditCtrl::GetSelectionCharFormat(), and then restore the original selection of the rich edit control.

Upvotes: 0

Related Questions