0

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.

1 Answers1

0

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.

Joseph Willcoxson
  • 5,853
  • 1
  • 15
  • 29
  • The problem is that setting a selection triggers a WM_PAINT message and that's the no-no for my situation because I need to get the format within the WM_PAINT handler. Thanks for replying, though. –  Feb 15 '15 at 06:21