[This is preliminary documentation and subject to change.]
The CHARFORMAT2 structure contains information about character formatting in a rich edit control. CHARFORMAT2 is a rich edit 2.0 extension of the CHARFORMAT structure. Rich edit 2.0 allows you to use either structure with the EM_GETCHARFORMAT and EM_SETCHARFORMAT messages.
typedef struct _charformat2 {
UINT cbSize;
_WPAD _wPad1;
DWORD dwMask;
DWORD dwEffects;
LONG yHeight;
LONG yOffset;
COLORREF crTextColor;
BYTE bCharSet;
BYTE bPitchAndFamily;
WCHAR szFaceName[LF_FACESIZE];
_WPAD _wPad2;
WORD wWeight;
SHORT sSpacing;
COLORREF crBackColor;
LCID lcid;
DWORD dwReserved;
SHORT sStyle;
WORD wKerning;
BYTE bUnderlineType;
BYTE bAnimation;
BYTE bRevAuthor;
BYTE bReserved1;
} CHARFORMAT2;
Set the following values to indicate the valid structure members.
Value | Meaning |
---|---|
CFM_ANIMATION | The bAnimation member is valid. |
CFM_BACKCOLOR | The crBackColor member is valid. |
CFM_CHARSET | The bCharSet member is valid. |
CFM_COLOR | The crTextColor member is valid unless the CFE_AUTOCOLOR flag is set in the dwEffects member. |
CFM_FACE | The szFaceName member is valid. |
CFM_KERNING | The wKerning member is valid. |
CFM_LCID | The lcid member is valid. |
CFM_OFFSET | The yOffset member is valid. |
CFM_REVAUTHOR | The bRevAuthor member is valid. |
CFM_SIZE | The yHeight member is valid. |
CFM_SPACING | The sSpacing member is valid. |
CFM_STYLE | The sStyle member is valid. |
CFM_UNDERLINETYPE | The bUnderlineType member is valid. |
CFM_WEIGHT | The wWeight member is valid. |
Set the following values to indicate the valid attributes of the dwEffects member:
Value | Meaning |
---|---|
CFM_ALLCAPS | The CFE_ALLCAPS value is valid. |
CFM_BOLD | The CFE_BOLD value is valid. |
CFM_COLOR | The CFE_AUTOCOLOR value is valid, or the crTextColor member is valid. |
CFM_DISABLED | The CFE_DISABLED value is valid. |
CFM_EMBOSS | The CFE_EMBOSS value is valid. |
CFM_HIDDEN | The CFE_HIDDEN value is valid. |
CFM_IMPRINT | The CFE_IMPRINT value is valid. |
CFM_ITALIC | The CFE_ITALIC value is valid. |
CFM_LINK | The CFE_LINK value is valid. |
CFM_OUTLINE | The CFE_OUTLINE value is valid. |
CFM_PROTECTED | The CFE_PROTECTED value is valid. |
CFM_REVISED | The CFE_REVISION value is valid. |
CFM_SHADOW | The CFE_SHADOW value is valid. |
CFM_SMALLCAPS | The CFE_SMALLCAPS value is valid. |
CFM_STRIKEOUT | The CFE_STRIKEOUT value is valid. |
CFM_SUBSCRIPT | The CFE_SUBSCRIPT and CFE_SUPERSCRIPT values are valid. |
CFM_SUPERSCRIPT | Same as CFM_SUBSCRIPT. |
CFM_UNDERLINE. | The CFE_UNDERLINE value is valid. |
This member can be a combination of the following values.
Value | Meaning |
---|---|
CFE_ALLCAPS | Characters are all capital letters. Does not affect the way the control displays the text. |
CFE_AUTOCOLOR | The text color is the return value of GetSysColor (COLOR_WINDOWTEXT). If this flag is set, the crTextColor member is ignored. |
CFE_BOLD | Characters are bold. |
CFE_DELETED | Marks the characters as deleted. |
CFE_EMBOSS | Characters are embossed. Does not affect how the control displays the text. |
CFE_HIDDEN | Characters are not displayed. Does not affect how the control displays the text. |
CFE_IMPRINT | Characters are displayed as imprinted characters. Does not affect how the control displays the text. |
CFE_ITALIC | Characters are italic. |
CFE_LINK | A rich edit control can send EN_LINK notification messages when it receives mouse messages while the mouse pointer is over text with the CFE_LINK effect. |
CFE_OUTLINE | Characters are displayed as outlined characters. Does not affect how the control displays the text. |
CFE_PROTECTED | Characters are protected; an attempt to modify them will cause an EN_PROTECTED notification message. |
CFE_REVISION | Marks the characters as revised. |
CFE_SHADOW | Characters are displayed as shadowed characters. Does not affect how the control displays the text. |
CFE_SMALLCAPS | Characters are in small capital letters. Does not affect how the control displays the text. |
CFE_STRIKEOUT | Characters are struck out. |
CFE_SUBSCRIPT | Characters are subscript. The CFE_SUPERSCRIPT and CFE_SUBSCRIPT values are mutually exclusive. For both values, the control automatically calculates an offset and a smaller font size. Alternatively, you can use the yHeight and yOffset members to explicitly specify font size and offset for subscript and superscript characters. |
CFE_SUPERSCRIPT | Characters are superscript. |
CFE_UNDERLINE | Characters are underlined. |
Value | Meaning |
---|---|
CFU_CF1UNDERLINE | Map CHARFORMAT's bit underline to CHARFORMAT2. |
CFU_INVERT | For IME composition fake a selection. |
CFU_UNDERLINE | Solid underline. |
CFU_UNDERLINEDOTTED | Dotted underlined text. The rich edit control displays the text with a solid underline. |
CFU_UNDERLINEDOUBLE | Double-underlined text. The rich edit control displays the text with a solid underline. |
CFU_UNDERLINENONE | No underline. This is the default. |
CFU_UNDERLINEWORD | Underline words only. The rich edit control displays the text with a solid underline. |
Windows NT: Requires version 4.0 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in richedit.h.
Unicode: Defined as Unicode and ANSI structures.
Rich Edit Controls Overview, Rich Edit Structures, CHARFORMAT, EM_GETCHARFORMAT, EM_SETCHARFORMAT, EN_PROTECTED, GetSysColor, LOGFONT, MAKELCID