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.
Simply subclass it (posted a long time ago on google groups, C/Winapi code)
来源:https://stackoverflow.com/questions/1139234/change-highlight-color-of-selected-text-in-richedit