0

ALL,

From MSDN

typedef struct _charformat2 {
  UINT     cbSize;
  DWORD    dwMask;
  DWORD    dwEffects;
  LONG     yHeight;
  LONG     yOffset;
  COLORREF crTextColor;
  BYTE     bCharSet;
  BYTE     bPitchAndFamily;
  TCHAR    szFaceName[LF_FACESIZE];
  WORD     wWeight;
  SHORT    sSpacing;
  COLORREF crBackColor;
  LCID     lcid;
#if (_RICHEDIT_VER >= 0x0500)
  union {
    DWORD dwReserved;
    DWORD dwCookie;
  };
#else 
  DWORD    dwReserved;
#endif 
  SHORT    sStyle;
  WORD     wKerning;
  BYTE     bUnderlineType;
  BYTE     bAnimation;
  BYTE     bRevAuthor;
#if (_RICHEDIT_VER >= 0x0800)
  BYTE     bUnderlineColor;
#endif 
} CHARFORMAT2;

The underline color is declared only for the control version >= 0x0800. However what should I do for the previous versions?

Also it looks like on Windows 8.1 this variable is not available. That is according to MSVC 2010.

So how do I make the bUnderlineType display the "red wave" underline and not use the standard black color?

Thank you.

[EDIT] Sorry, I just recently found this contradiction in MSDN... While this page says it is available in the RichEdit 4.1+, this page says it is available in the RichEdit 3.0+. Now I know nobody cares about RichEdit 1.0, but a lot of systems are still using XP, whhich is 3.0, since MS Word does have the red squiggly underlining there. Trouble is - while the underlinetype setting is pretty straightforward, the coloring of the underline on 3.0 is not. Anybody have an idea of what to do? [/EDIT]

Igor
  • 5,620
  • 11
  • 51
  • 103
  • 1
    http://stackoverflow.com/questions/1756263/how-to-change-underlining-color-in-a-rich-edit-control-win32-c – edtheprogrammerguy Sep 01 '15 at 02:18
  • @edtheprogrammerguy, I tried the suggestion from the comment, i.e. "cf.bUnderlineType = CFU_UNDERLINEWAVE | 0x05;", but it does not work. I don't have use version 4 therefore I'm asking how to do it in versions 2 and 3. Any idea? – Igor Sep 01 '15 at 04:24

1 Answers1

0

So how do I make the bUnderlineType display the "red wave" underline and not use the standard black color?

....

I don't have use version 4 therefore I'm asking how to do it in versions 2 and 3.

From the documentation:

CFU_UNDERLINEWAVE

RichEdit 4.1 and later: Text underlined with a wavy line.

and

#if (_RICHEDIT_VER >= 0x0800)
  BYTE     bUnderlineColor;
#endif

So the functionality that you are looking for does not exist in the old rich edit versions that you are targeting.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • From another MSDN page: https://msdn.microsoft.com/en-us/library/windows/desktop/bb787873%28v=vs.85%29.aspx#_win32_Rich_Edit_Version_3.0, this functionality exists in version 3.0. Now while wave underline is straightforward, the coloring underline is not explained anywhere. And the undocumented code used in the comment does not work. – Igor Sep 02 '15 at 01:18