Help Center

CRichEdit.SetMarginsmethod

Sets the widths of the left and right margins for a rich edit control. The message redraws the control to reflect the new margins.

Windowsmethoddocumented

Syntax

PRIVATE SUB CRichEdit.SetMargins (BYVAL hRichEdit AS HWND, BYVAL nMargins AS LONG, BYVAL nWidth AS LONG)

Parameters

NameDescription
hRichEditThe handle of the rich edit control.
nMarginsTThe margins to set. This parameter can be one or more of the following values.
EC_LEFTMARGIN. Sets the left margin.
EC_RIGHTMARGIN. Sets the right margin.
EC_USEFONTINFO. Sets the left and right margins to a narrow width calculated using the text metrics of the control's current font. If no font has been set for the control, the margins are set to zero. The nWidth parameter is ignored.
nWidthThe LOWORD specifies the new width of the left margin, in pixels. This value is ignored if nMargins does not include EC_LEFTMARGIN.
Rich Edit 3.0 and later: The LOWORD can specify the EC_USEFONTINFO value to set the left margin to a narrow width calculated using the text metrics of the control's current font. If no font has been set for the control, the margin is set to zero.
The HIWORD specifies the new width of the right margin, in pixels. This value is ignored if nMargins does not include EC_RIGHTMARGIN.
Rich Edit 3.0 and later: The HIWORD can specify the EC_USEFONTINFO value to set the right margin to a narrow width calculated using the text metrics of the control's current font. If no font has been set for the control, the margin is set to zero

Description

Sets the widths of the left and right margins for a rich edit control. The message redraws the control to reflect the new margins.

SetLimitText ad LimitText are the same message.

Example

PRIVATE SUB SetMargins (BYVAL hRichEdit AS HWND, BYVAL nMargins AS LONG, BYVAL nWidth AS LONG)

Reference

  • Defined in AfxNova/CRichEdit.inc:1076
  • Documented in Windows/WIndows Controls/CRichEdit Class.md
  • Topic: CRichEdit Class