How to Automatically Resize Rich Edit Controls

An application can resize a rich edit control as needed so that it is always the same size as its contents. A rich edit control supports this so-called bottomless functionality by sending its parent window an EN_REQUESTRESIZE notification code whenever the size of the control's content changes.

What you need to know

Technologies

Prerequisites

  • C/C++
  • Windows User Interface Programming

Instructions

Automatically Resize a Rich Edit Control

When processing the EN_REQUESTRESIZE notification code, an application should resize the control to the dimensions in the specified REQRESIZE structure. An application might also move any information that is near the control to accommodate the control's change in height. To resize the control, you can use the SetWindowPos function.

You can force a bottomless rich edit control to send an EN_REQUESTRESIZE notification code by using the EM_REQUESTRESIZE message. This message can be useful when processing the WM_SIZE message.

Remarks

To receive EN_REQUESTRESIZE notification codes, you must enable the notification by using the EM_SETEVENTMASK message.

Related topics

Using Rich Edit Controls
Windows common controls demo (CppWindowsCommonControls)

 

 

Community Additions

ADD
Show:
© 2015 Microsoft