At the end of the Color.CPP file, add the new local function, CalcClientMetrics, which interprets the WM_SIZE message's client area parameters.
/*---[CalcClientMetrics]-------------------------------------------------------Parameters: HWND hWnd Window handleint *nClientWidth Width in and width outint *nClientHeight Height in and height outint *nRightBarThickness Resulting thickness of the Y scrollbarint *nBottomBarThickness Resulting thickness of the X scrollbarProtoType: Color.hNotes: Use this function to interpret the client area width andheight parameters from the WM_SIZE message. The incomingparameters attempt to give us the correct client area, excludingscrollbars. But, because while processing this message weshow or hide the scrollbars, the incoming parameters often arenot correct. Therefore, we must get the true client areadimensions, including scrollbars, and get the thickness ofscrollbars. The caller can then make its own decisions aboutthe size of the client area.--------------------------------------------------------------------------*/void CalcClientMetrics (HWND hWnd,int *nClientWidth,int *nClientHeight,int *nRightBarThickness,int *nBottomBarThickness){DWORD dwStyle, dwVersion;int cxClient, cyClient, cxScroll, cyScroll;/* Initialize local variables */cxClient = *nClientWidth;cyClient = *nClientHeight;cxScroll = GetSystemMetrics(SM_CXVSCROLL);cyScroll = GetSystemMetrics(SM_CYHSCROLL);dwStyle = GetWindowLong(hWnd, GWL_STYLE);/* Adjust for the difference in how newer WIN32 versions reportscrollbar thickness when there is a window border */dwVersion = GetVersion();if (LOBYTE(LOWORD(dwVersion)) >= 4){cxScroll += GetSystemMetrics(SM_CXBORDER);cyScroll += GetSystemMetrics(SM_CYBORDER);}/* If there is a window border, subtract it from the scrollbar thickness */if (dwStyle & WS_BORDER){cxScroll -= GetSystemMetrics(SM_CXBORDER);cyScroll -= GetSystemMetrics(SM_CYBORDER);}/* Add the scrollbar thickness to the client area */if (dwStyle & WS_VSCROLL)cxClient += cxScroll;if (dwStyle & WS_HSCROLL)cyClient += cyScroll;/* Update the caller's variables */*nClientWidth = cxClient;*nClientHeight = cyClient;*nRightBarThickness = cxScroll;*nBottomBarThickness = cyScroll;}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
