1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0023628: Snapshots have wrong dimension when OCCT is built by VC++ 11

Use AdjustWindowRect() function to adjust window rectangle instead of
manual GetSystemMetrics().
This commit is contained in:
kgv
2012-12-17 12:44:37 +04:00
committed by Roman Lygin
parent e6aad0ee24
commit 7fe83417f1
2 changed files with 36 additions and 29 deletions

View File

@@ -119,15 +119,18 @@ WNT_Window::WNT_Window (const Handle(WNT_GraphicDevice)& theDevice,
dwStyle |= WS_CLIPCHILDREN;
}
if (dwStyle & WS_OVERLAPPEDWINDOW)
{
// include decorations in the window dimensions
// to reproduce same behaviour of Xw_Window.
aXLeft -= GetSystemMetrics(SM_CXSIZEFRAME);
aYTop -= GetSystemMetrics(SM_CYSIZEFRAME) + GetSystemMetrics(SM_CYCAPTION);
aXRight += GetSystemMetrics(SM_CXSIZEFRAME);
aYBottom += GetSystemMetrics(SM_CYSIZEFRAME);
}
// include decorations in the window dimensions
// to reproduce same behaviour of Xw_Window.
RECT aRect;
aRect.top = aYTop;
aRect.bottom = aYBottom;
aRect.left = aXLeft;
aRect.right = aXRight;
AdjustWindowRect (&aRect, dwStyle, theMenu != NULL ? TRUE : FALSE);
aXLeft = aRect.left;
aYTop = aRect.top;
aXRight = aRect.right;
aYBottom = aRect.bottom;
myHWindow = CreateWindow (
myWClass->Name(), // window's class name
@@ -198,15 +201,18 @@ WNT_Window::WNT_Window (const Handle(WNT_GraphicDevice)& theDevice,
dwStyle |= WS_CLIPCHILDREN;
}
if (dwStyle & WS_OVERLAPPEDWINDOW)
{
// include decorations in the window dimensions
// to reproduce same behaviour of Xw_Window.
aXLeft -= GetSystemMetrics(SM_CXSIZEFRAME);
aYTop -= GetSystemMetrics(SM_CYSIZEFRAME) + GetSystemMetrics(SM_CYCAPTION);
aXRight += GetSystemMetrics(SM_CXSIZEFRAME);
aYBottom += GetSystemMetrics(SM_CYSIZEFRAME);
}
// include decorations in the window dimensions
// to reproduce same behaviour of Xw_Window.
RECT aRect;
aRect.top = aYTop;
aRect.bottom = aYBottom;
aRect.left = aXLeft;
aRect.right = aXRight;
AdjustWindowRect (&aRect, dwStyle, theMenu != NULL ? TRUE : FALSE);
aXLeft = aRect.left;
aYTop = aRect.top;
aXRight = aRect.right;
aYBottom = aRect.bottom;
myHWindow = CreateWindow (
myWClass->Name(), // window's class name