Export (0) Print
Expand All
MFC
Expand Minimize

CRichEditCtrl::SetParaFormat 

Sets the paragraph formatting attributes for the current selection in this CRichEditCtrl object.


BOOL SetParaFormat(
   PARAFORMAT& pf 
);
BOOL SetParaFormat(
   PARAFORMAT2& pf 
);

Parameters

pf

In the first version, a pointer to a PARAFORMAT structure containing the new default paragraph formatting attributes.

In the second version, a pointer to a PARAFORMAT2 structure, which is a Rich Edit 2.0 extension to the PARAFORMAT structure, holding the default character formatting attributes.

Nonzero if successful; otherwise, 0.

Only the attributes specified by the dwMask member of pf are changed by this function.

For more information, see the EM_SETPARAFORMAT message and the PARAFORMAT and PARAFORMAT2 structures in the Platform SDK.

// The pointer to my rich edit control.
extern CRichEditCtrl* pmyRichEditCtrl;
PARAFORMAT pf;

// Modify the paragraph format so that the text is centered. 
pf.cbSize = sizeof(PARAFORMAT);
pf.dwMask = PFM_ALIGNMENT;
pf.wAlignment = PFA_CENTER;
pmyRichEditCtrl->SetParaFormat(pf);

// Verify the settings are what is expected.
#ifdef _DEBUG
   pmyRichEditCtrl->GetParaFormat(pf);
   ASSERT(pf.dwMask&PFM_ALIGNMENT);
   ASSERT(pf.wAlignment == PFA_CENTER);
#endif

Community Additions

ADD
Show:
© 2014 Microsoft