Share via


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.

Return Value

Nonzero if successful; otherwise, 0.

Remarks

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 Windows SDK.

Example

PARAFORMAT pf;

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

// Verify the settings are what is expected.
m_myRichEditCtrl.GetParaFormat(pf);
ASSERT(pf.dwMask&PFM_ALIGNMENT);
ASSERT(pf.wAlignment == PFA_CENTER);

Requirements

Header: afxcmn.h

See Also

Reference

CRichEditCtrl Class

Hierarchy Chart

CRichEditCtrl::GetParaFormat

CRichEditCtrl::SetSelectionCharFormat

Other Resources

CRichEditCtrl Members