Cedit attributes:
In mulitline, edit is divided into three layers: NC, client (wordless area), and text area (setrect)
In singleline, edit is only divided into the NC and client regions, that is, the client region and the text region overlap (in this case, setrect is invalid)
Getrect, setrect -- set the text area and subtract one from the client. It is only valid for multiple rows? When a single row is used, the two always overlap. Es_multiline, es_wantreturn!
Wm_nccalcsize: lprect rc = (lprect) lparam; Calculate non-customer zones
Crect rcttext;
: Sendmessage (heditdir, em_getrect, 0, (lparam) & rcttext );
Rcttext. offsetrect (0, 10 );
: Sendmessage (heditdir, em_setrect, 0, (lparam) & rcttext );
After the edit window is subclass-type, since the edit window has been created, your editproc cannot receive wm_nccalcsize, so you can move the edit window after subclass to re-trigger this message
Cedit draw sequence:
Wm_ncpaint: When multi line is used, ncpaint will fl the customer area, so you need to pay attention to tailoring; when single line is used, it cannot be flushed If You Want To fl the customer area.
Erasebk -- fl the client area (it is useless in single line mode, because it overlaps with the text area, and the text area is finally drawn)
Wm_ctlcolor nctlcolor = ctlcolor_edit; here, the background of the text area is flushed. (You can paint the image directly here, but return the null brush, or if you do not paint the image, but return a non-null brush)
Wm_paint won't get it ???
Case wm_ncpaint:
{
HDC;
HDC = getdcex (hwnd, (hrgn) wparam, dcx_window | dcx_intersectrgn );
// Paint into this DC
Releasedc (hwnd, HDC );
}