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.

Remarks

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

Example

CRect r;

m_myRichEditCtrl.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);
   m_myRichEditCtrl.SetRect(&r);
}

Requirements

Header: afxcmn.h

See Also

Reference

CRichEditCtrl Class

Hierarchy Chart

CRichEditCtrl::GetRect