SetSelectionCharFormat
Sets the character formatting attributes in the current selection in this RichEdit control.
BOOL SetSelectionCharFormat( CHARFORMAT & cf )
Nonzero if successful; otherwise, 0.
EX1
#include <..\OriginLab\DialogEx.h> #define IDC_RICHEDIT1 1001 void RichEdit_SetSelectionCharFormat(Dialog& EditBoxes) { RichEdit richEdit = EditBoxes.GetItem(IDC_RICHEDIT1); CHARFORMAT cf; cf.dwEffects = CFE_BOLD; cf.dwMask = CFM_STRIKEOUT|CFM_BOLD; richEdit.SetSelectionCharFormat(cf); CHARFORMAT cfResult; richEdit.GetSelectionCharFormat(cfResult); ASSERT((cfResult.dwMask&(CFM_STRIKEOUT|CFM_BOLD)) == (CFM_STRIKEOUT|CFM_BOLD)); ASSERT((cfResult.dwEffects & (CFE_STRIKEOUT|CFE_BOLD) ) == CFE_BOLD); }
Call this function to set the character formatting attributes for the text in the current selection in this RichEdit control.
Only the attributes specified by the dwMask member of cf are changed by this function.
RichEdit::GetSelectionCharFormat
Control.h