Help Center

CRichEditCtx.SetLeftMarginmethod

Windowsmethoddocumented

Syntax

SUB SetLeftMargin (BYVAL nWidth AS LONG)
Also documented as Margins — one description covers them all.

Parameters

NameDescription
nMarginsThe 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.

Examples

pRichEdit.SetMargins(EC_LEFTMARGIN, MAKELONG(50, 0)) --or-- pRichEdit.SetMargins(EC_LEFTMARGIN, MAKELONG(50)) --or-- pRichEdit.Margins(EC_LEFTMARGIN) = MAKELONG(50, 0) --or-- pRichEdit.LeftMargin = 50

pRichEdit.SetMargins(EC_RIGHTMARGIN, MAKELONG(0, 50)) --or-- pRichEdit.Margins(EC_RIGHTMARGIN) = MAKELONG(0, 50) --or-- pRichEdit.RightMargin = 50

pRichEdit.SetMargins(EC_LEFTMARGIN OR EC_RIGHTMARGIN, MAKELONG(50, 50)) --or-- pRichEdit.Margins(EC_LEFTMARGIN OR EC_RIGHTMARGIN) = MAKELONG(50, 50)

Set the left margin Set the right margin Set both margins

Reference

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