Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.


Call this function to format a range of text in a rich edit control to fit within rectLayout for the device specified by pDC.

long PrintInsideRect(
   CDC* pDC,
   RECT& rectLayout,
   long nIndexStart,
   long nIndexStop,
   BOOL bOutput 



Pointer to a device context for the output area.


RECT or CRect which defines the output area.


Zero-based index of the first character to be formatted.


Zero-based index of the last character to be formatted.


Indicates if the text should be rendered. If FALSE, the text is just measured.

The index of the last character that fits in the output area plus one.

Typically, this call is followed by a call to CRichEditCtrl::DisplayBand which generates the output.

See the example for CRichEditView::GetPaperSize.

Community Additions

© 2015 Microsoft