2.2.6.27.28 RichEdit::SetSelectionCharFormat

Description

Sets the character formatting attributes in the current selection in this RichEdit control.

Syntax

BOOL SetSelectionCharFormat( CHARFORMAT & cf )

Parameters

cf
CHARFORMAT structure containing the new character
formatting attributes for the current selection.

Return

Nonzero if successful; otherwise, 0.

Examples

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);
}

Remark

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.

See Also

RichEdit::GetSelectionCharFormat

Header to Include

Control.h