質問

hWndEdit = CreateWindow(TEXT("edit"),
            NULL, WS_CHILD | WS_VISIBLE | ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL | WS_BORDER,
            pt.x, pt.y, 100, 50, hWnd, (HMENU)ID_EDIT, hInst, NULL);

RECT* rect_temp;

rect_temp = new RECT();

SendMessage(hWndEdit, EM_GETRECT, 0, (LPARAM)rect_temp);

PS:the problem is what I get is always (2,2,34,98).

役に立ちましたか?

解決

from MSDN for EM_GETRECT:

Gets the formatting rectangle of an edit control. The formatting rectangle is the limiting rectangle into which the control draws the text. The limiting rectangle is independent of the size of the edit-control window. You can send this message to either an edit control or a rich edit control.

the part:

The limiting rectangle is independent of the size of the edit-control window.

CreateWindow creates whole control not what inside it, to modify inside formatting of EDIT use EM_SETRECT .

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top