GetSelectionCharFormat
Retrieves the character formatting attributes in the current selection in this RichEdit control.
DWORD GetSelectionCharFormat( CHARFORMAT & cf )
The dwMask data member of cf. It specifies the character formatting attributes
that are consistent throughout the current selection.
Remarks
Call this function to get the character formatting attributes
of the current selection. The cf parameter receives the
attributes of the first character in the current selection.
The return value specifies which attributes are consistent
throughout the selection.
EX1
#include <..\OriginLab\DialogEx.h> #define IDC_RICHEDIT1 1001 void RichEdit_GetSelectionCharFormat(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); }
RichEdit::SetSelectionCharFormat
Control.h