CRichEditCtrl::SetDefaultCharFormat

BOOL SetDefaultCharFormat( CHARFORMAT& cf );

Return Value

Nonzero if successful; otherwise, 0.

Parameters

cf

CHARFORMAT structure containing the new default character formatting attributes.

Remarks

Call this function to set the character formatting attributes for new text in this CRichEditCtrl object. Only the attributes specified by the dwMask member of cf are changed by this function.

For more information, see EM_SETCHARFORMAT message and CHARFORMAT structure in the Win32 documentation.

Example

// The pointer to my rich edit control.
extern CRichEditCtrl* pmyRichEditCtrl;
CHARFORMAT cf;

// Modify the default character format so that all new
// text is striked out and not bold.
cf.dwMask = CFM_STRIKEOUT|CFM_BOLD;
cf.dwEffects = CFE_STRIKEOUT;
pmyRichEditCtrl->SetDefaultCharFormat(cf);

// Verify the settings are what is expected.
#ifdef _DEBUG
   pmyRichEditCtrl->GetDefaultCharFormat(cf);
   ASSERT((cf.dwMask&(CFM_STRIKEOUT|CFM_BOLD)) == 
      (CFM_STRIKEOUT|CFM_BOLD));
   ASSERT((cf.dwEffects&(CFE_STRIKEOUT|CFE_BOLD)) == CFE_STRIKEOUT);
#endif

CRichEditCtrl OverviewClass MembersHierarchy Chart

See Also   CRichEditCtrl::GetDefaultCharFormat, CRichEditCtrl::SetSelectionCharFormat