Help Center

CRichEdit.SetCharFormatmethod

Sets character formatting in a rich edit control.

Windowsmethoddocumented

Syntax

FUNCTION SetCharFormat (BYVAL hRichEdit AS HWND, BYVAL chfmt AS DWORD, BYVAL lpcf AS CHARFORMATW PTR) AS LONG

Parameters

NameDescription
hRichEditThe handle of the rich edit control.
chfmtCharacter formatting that applies to the control. If this parameter is zero, the default character format is set. Otherwise, it can be one of the following values (see Formatting values below).
lpcfPointer to a CHARFORMAT structure specifying the character formatting to use. Only the formatting attributes specified by the dwMask member are changed. The szFaceName and bCharSet members may be overruled when invalid for characters, for example: Arial on kanji characters.

Return value

If the operation succeeds, the return value is a nonzero value.

If the operation fails, the return value is zero.

Description

Sets character formatting in a rich edit control.

Remarks

If this message is sent more than once with the same parameters, the effect on the text is toggled. That is, sending the message once produces the effect, sending the message twice cancels the effect, and so forth.

Reference

  • Defined in AfxNova/CRichEdit.inc:962
  • Documented in Windows/WIndows Controls/CRichEdit Class.md
  • Topic: CRichEdit Class