The TRichEdit control supports the functionality to not only change the underline style, but its color, via the TCharFormat structure.
The colors that can be used are listed in the documentation as these:
UnderlineColor_Black = 0x00;
UnderlineColor_Blue = 0x01;
UnderlineColor_Aqua = 0x02;
UnderlineColor_Lime = 0x03;
UnderlineColor_Fuchsia = 0x04;
UnderlineColor_Red = 0x05;
UnderlineColor_Yellow = 0x06;
UnderlineColor_White = 0x07;
UnderlineColor_Navy = 0x08;
UnderlineColor_Teal = 0x09;
UnderlineColor_Green = 0x0A;
UnderlineColor_Purple = 0x0B;
UnderlineColor_Maroon = 0x0C;
UnderlineColor_Olive = 0x0D;
UnderlineColor_DkGray = 0x0E;
UnderlineColor_LtGray = 0x0F;
But those constants are not defined in the Windows SDK headers, and also have to be set in a different way for RichEdit 2.0 and for RichEdit 4.1.
For RichEdit 2.0: Shift the color code of the above constants one digit to the left, and OR it with the underline style.
For RichEdit 4.1: Add 1 to the color code, and set it in the bUnderlineColor member.
Wiki: OWLNext_Roadmap_and_Prereleases
Anonymous
Diff:
Hi Jogy,
I have reviewed [r5868], which added this feature on the trunk. Here are some suggestions:
To illustrate the difference between Rich Edit 2 and 4, as regards default underline type:
Note: The use of enum class requires C++11 and can hence not be used on the 6.44 branch. However, classic enums can be used there, with just a slight API difference as regards qualification (e.g. TCharFormat::TUnderlineColor::Black vs TCharFormat::Black).
I have implemented the suggested improvements on the trunk in [r5869]. The revision also includes an update and a few changes to the test code in "examples/classes".
Related
Commit: [r5868]
Commit: [r5869]
Support for mapping from TColor to TUnderlineColor in TCharFormat, with new overloads SetUnderline(TColor) and SetUnderline(TUnderlineType, TColor), was added in [r5870] (with an internal improvement to the mapping algorithm in [r5872]).
Related
Commit: [r5870]
Commit: [r5872]