Create a square C ++ window

Stuck on a little problematic issue. I am creating a GUI in C ++ using XP and VS C ++ using the CreateWindow () command.

My question is: how to make the inner area, painted with paint, an ideal area. When passing in the size of the created window, some of them are subtracted for the menu bar at the top, borders around, etc. Are there any real-time variables that I can pass, for example. to create a window 500x500 will be:

...500+BORDER,500+MENU_TOP+BORDER...

Thank you all

+3
source share
3 answers

AdjustWindowRect. , ( , ). :

RECT rect = {0, 0, desiredWidth, desiredHeight};

AdjustWindowRect(&rect, windowStyle, hasMenu);

const int realWidth = rect.right - rect.left;
const int realHeight = rect.bottom - rect.top;

realWidth realHeight CreateWindow.

, , , .

+4

( , ..) : GetSystemMetrics(). ,

0

GetSystemMetrics().

, SM_CXMENU SM_CYMENU.

0

Source: https://habr.com/ru/post/1729797/


All Articles