Export (0) Print
Expand All
MFC
Expand Minimize

CRichEditCtrl::SetRect 

Sets the formatting rectangle for this CRichEditCtrl object.


void SetRect(
   LPCRECT lpRect 
);

Parameters

lpRect

CRect or pointer to a RECT that indicates the new bounds for the formatting rectangle.

The formatting rectangle is the limiting rectangle for the text. The limiting rectangle is independent of the size of the rich edit control window. When this CRichEditCtrl object is first created, the formatting rectangle is the same size as the client area of the window. Use SetRect to make the formatting rectangle larger or smaller than the rich edit window.

For more information, see EM_SETRECT in the Platform SDK.

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

CRect r;

pmyRichEditCtrl->GetRect(&r);

// Reduce the formatting rect of the rich edit control by
// 10 pixels on each side.
if ((r.Width() > 20) && (r.Height() > 20))
{
   r.DeflateRect(0, 20);
   pmyRichEditCtrl->SetRect(&r);
}

Community Additions

ADD
Show:
© 2014 Microsoft