EM_SETMARGINS message

Sets the widths of the left and right margins for an edit control. The message redraws the control to reflect the new margins. You can send this message to either an edit control or a rich edit control.

Parameters

wParam

The margins to set. This parameter can be one or more of the following values.

Value Meaning
EC_LEFTMARGIN
Sets the left margin.
EC_RIGHTMARGIN
Sets the right margin.
EC_USEFONTINFO
Rich edit controls: 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 lParam parameter is ignored.
Edit controls: The EC_USEFONTINFO value cannot be used in the wParam parameter. It can only be used in the lParam parameter.

lParam

The LOWORD specifies the new width of the left margin, in pixels. This value is ignored if wParam does not include EC_LEFTMARGIN.

Edit controls and 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 wParam does not include EC_RIGHTMARGIN.

Edit controls and 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.

Return value

This message does not return a value.

Remarks

Edit controls: You cannot use EC_USEFONTINFO in the wParam parameter, but you can use it in the lParam parameter.

Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. All rich edit versions support the use of EC_USEFONTINFO in the wParam parameter. However, only Microsoft Rich Edit 3.0 and later support the use of EC_USEFONTINFO in the lParam parameter. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls.

Requirements

Requirement Value
Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Header
Winuser.h (include Windows.h)

See also

EM_GETMARGINS