sysc4ll
sysc4ll

Reputation: 1

How to automatically manage the height of an EDIT Win32 API Control

How to automatically manage the height of an EDIT Win32 API Control.

I have created this EDIT control like this :

hwndFileEdit = CreateWindow("EDIT", nullptr, WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL | ES_READONLY | ES_LEFT, 0, 0, 0, 0, hWnd, (HMENU)IDC_FILE_EDIT, hInst, nullptr);

And set the size :

MoveWindow(hwndFileEdit, 15, 15, rc.right - rc.left - (15 + 80 + 15 + 15), 25, TRUE);

What I have to do ? Please

Upvotes: -1

Views: 39

Answers (1)

Jeaninez - MSFT
Jeaninez - MSFT

Reputation: 4040

You could try to use the GetTextExtentPoint32 function to compute the width and height of the specified string of text. Calculate the size of the ideal control based on the text size. And then resizing the control to the calculated size.

Upvotes: 0

Related Questions