views:

657

answers:

1

How do I change the color of selected text in a RichEdit control, while the text is being selected? SetSysColor() can do it, but that changes the Highlight-color globally.

Setting a CHARFORMAT2 with SCF_SELECTION, and sending a EM_SETCHARFORMAT does change the font and background color. But is only visible once you deselect the same range. That's not really helpful, since I want it to be the original color again once something is deselected.

So, how it's really done puzzles me.

A: 

Simply subclass it (posted a long time ago on google groups, C/Winapi code)

Non-MFC project... but do you know how MFC manages to do exactly that?
Ricardo