Help Center

CRichEditCtx.FormatRangemethod

Formats a range of text in a rich edit control for a specific device.

Windowsmethoddocumented

Syntax

FUNCTION FormatRange (BYVAL fRender AS LONG, BYREF fr AS FORMATRANGE) AS DWORD

Parameters

NameDescription
fRenderSpecifies whether to render the text. If this parameter is not zero, the text is rendered. Otherwise, the text is just measured.
frA FORMATRANGE structure containing information about the output device, or NULL to free information cached by the control.

Return value

This method returns the index of the last character that fits in the region, plus 1.

Description

Formats a range of text in a rich edit control for a specific device.

Remarks

This method is typically used to format the content of rich edit control for an output device such as a printer.

After using this method to format a range of text, it is important that you free cached information by sending FormatRange again, but with fr set to NULL; otherwise, a memory leak will occur. Also, after using this message for one device, you must free cached information before using it again for a different device.

Reference

  • Defined in AfxNova/CRichEditCtx.inc:2102
  • Documented in Windows/WIndows Controls/RichEdit/CRichEditCtx Class.md
  • Topic: CRichEditCtx Class