CHARFORMAT2A structure (richedit.h)

Contains information about character formatting in a rich edit control. CHARFORMAT2 is a Microsoft Rich Edit 2.0 extension of the CHARFORMAT structure. Microsoft Rich Edit 2.0 allows you to use either structure with the EM_GETCHARFORMAT and EM_SETCHARFORMAT messages.

Syntax

struct CHARFORMAT2A : _charformat {
  WORD     wWeight;
  SHORT    sSpacing;
  COLORREF crBackColor;
  LCID     lcid;
  union {
    DWORD dwReserved;
    DWORD dwCookie;
  };
  DWORD    dwReserved;
  SHORT    sStyle;
  WORD     wKerning;
  BYTE     bUnderlineType;
  BYTE     bAnimation;
  BYTE     bRevAuthor;
  BYTE     bUnderlineColor;
};

Inheritance

The CHARFORMAT2A structure implements _charformat.

Members

wWeight

Type: WORD

Font weight. This member is the same as the lfWeight member of the LOGFONT structure. To use this member, set the CFM_WEIGHT flag in the dwMask member.

sSpacing

Type: SHORT

Horizontal space between letters, in twips. This value has no effect on the text displayed by a rich edit control; it is included for compatibility with Windows TOM interfaces. To use this member, set the CFM_SPACING flag in the dwMask member.

crBackColor

Type: COLORREF

Background color. To use this member, set the CFM_BACKCOLOR flag in the dwMask member. This member is ignored if the CFE_AUTOBACKCOLOR character effect is specified. To generate a , use the macro.

lcid

Type: LCID

A 32-bit locale identifier that contains a language identifier in the lower word and a sorting identifier and reserved value in the upper word. This member has no effect on the text displayed by a rich edit control, but spelling and grammar checkers can use it to deal with language-dependent problems. You can use the macro to create an LCID value. To use this member, set the CFM_LCID flag in the dwMask member.

dwReserved

Type: DWORD

Reserved; the value must be zero.

Type: DWORD

Reserved; the value must be zero.

dwCookie

Type: DWORD

Client cookie. This member is opaque to a rich edit control.

sStyle

Type: SHORT

Character style handle. This value has no effect on the text displayed by a rich edit control; it is included for compatibility with WindowsTOM interfaces. To use this member, set the CFM_STYLE flag in the dwMask member. For more information see the TOM documentation.

wKerning

Type: WORD

Value of the font size, above which to kern the character (yHeight). This value has no effect on the text displayed by a rich edit control; it is included for compatibility with TOM interfaces. To use this member, set the CFM_KERNING flag in the dwMask member.

bUnderlineType

Type: BYTE

Specifies the underline type. To use this member, set the CFM_UNDERLINETYPE flag in the dwMask member. This member can be one of the following values.

Value Meaning
CFU_CF1UNDERLINE
The structure maps CHARFORMAT's bit underline to CHARFORMAT2, (that is, it performs a CHARFORMAT type of underline on this text).
CFU_INVERT
For IME composition, fake a selection.
CFU_UNDERLINE
Text underlined with a single solid line.
CFU_UNDERLINEDASH
Text underlined with dashes.
CFU_UNDERLINEDASHDOT
Text underlined with a dashed and dotted line.
CFU_UNDERLINEDASHDOTDOT
Text underlined with a dashed and doubled dotted line.
CFU_UNDERLINEDOTTED
Text underlined with a dotted line. For versions earlier than Microsoft Rich Edit 3.0, text is displayed with a solid underline.
CFU_UNDERLINEDOUBLE
Text underlined with a double line. The rich edit control displays the text with a solid underline.
CFU_UNDERLINEDOUBLEWAVE
Display as CFU_UNDERLINEWAVE.
CFU_UNDERLINEHAIRLINE
Display as CFU_UNDERLINE.
CFU_UNDERLINEHEAVYWAVE
Display as CFU_UNDERLINEWAVE.
CFU_UNDERLINELONGDASH
Display as CFU_UNDERLINEDASH.
CFU_UNDERLINENONE
No underline. This is the default.
CFU_UNDERLINETHICK
Display as CFU_UNDERLINE.
CFU_UNDERLINETHICKDASH
Display as CFU_UNDERLINEDASH.
CFU_UNDERLINETHICKDASHDOT
Display as CFU_UNDERLINEDASHDOT.
CFU_UNDERLINETHICKDASHDOTDOT
Display as CFU_UNDERLINEDASHDOT.
CFU_UNDERLINETHICKDOTTED
Display as CFU_UNDERLINEDOT.
CFU_UNDERLINETHICKLONGDASH
Display as CFU_UNDERLINEDASH.
CFU_UNDERLINEWAVE
RichEdit 4.1 and later: Text underlined with a wavy line.
CFU_UNDERLINEWORD
RichEdit 4.1 and later: Underline words only. The rich edit control displays the text with a solid underline.

bAnimation

Type: BYTE

Text animation type. This value has no effect on the text displayed by a rich edit control; it is included for compatibility with TOM interfaces. To use this member, set the CFM_ANIMATION flag in the dwMask member.

bRevAuthor

Type: BYTE

An index that identifies the author making a revision. The rich edit control uses different text colors for each different author index. To use this member, set the CFM_REVAUTHOR flag in the dwMask member.

bUnderlineColor

Type: BYTE

Underline color:

  • 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;

Remarks

To turn off a formatting attribute, set the appropriate value in dwMask but do not set the corresponding value in dwEffects. For example, to turn off italics, set CFM_ITALIC but do not set CFE_ITALIC.

Note

The richedit.h header defines CHARFORMAT2 as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

   
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Header richedit.h

See also

CHARFORMAT

COLORREF

EM_GETCHARFORMAT

EM_SETCHARFORMAT

EN_PROTECTED

GetSysColor

LOGFONT

RGB