-
November 28th, 2015, 02:44 AM
#1
How compute windows size with and without border?
I am working under Windows 8.1; I test window size with border and without border. Horizontal difference is 16, vertical 39. 39 = cyCaption+16;
Frame has 8 on all sides? Why cySizeFrame = 4 and cyBorder is only 1 ?
Code:
SetWindowPos(hWnd, HWND_TOP, 100, 100, 300, 70, SWP_SHOWWINDOW);
RECT rcClient, rcWind;
GetClientRect(hWnd, &rcClient);
GetWindowRect(hWnd, &rcWind);
int xdiff = (rcWind.right-rcWind.left)-(rcClient.right-rcClient.left);//16
int ydiff = (rcWind.bottom-rcWind.top)-(rcClient.bottom-rcClient.top);//39
int cxSizeFrame = GetSystemMetrics(SM_CXSIZEFRAME);
int cySizeFrame = GetSystemMetrics(SM_CXSIZEFRAME);
int cyCaption = GetSystemMetrics(SM_CYCAPTION);
int cyBorder = GetSystemMetrics(SM_CYBORDER);.
-
November 30th, 2015, 05:22 AM
#2
Re: How compute windows size with and without border?
Originally Posted by Borneq
Code:
SetWindowPos(hWnd, HWND_TOP, 100, 100, 300, 70, SWP_SHOWWINDOW);
RECT rcClient, rcWind;
GetClientRect(hWnd, &rcClient);
GetWindowRect(hWnd, &rcWind);
int xdiff = (rcWind.right-rcWind.left)-(rcClient.right-rcClient.left);//16
int ydiff = (rcWind.bottom-rcWind.top)-(rcClient.bottom-rcClient.top);//39
int cxSizeFrame = GetSystemMetrics(SM_CXSIZEFRAME);
int cySizeFrame = GetSystemMetrics(SM_CXSIZEFRAME);
int cyCaption = GetSystemMetrics(SM_CYCAPTION);
int cyBorder = GetSystemMetrics(SM_CYBORDER);.
This is not what you want in cySizeFrame, right?
Best regards,
Igor
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|