没有精确的一对一替换函数,但是
AdjustWindowRectEx
很接近。如果使用
CWnd::adjustOutside
你需要自己调整滚动条。
例如:
// MFC version
RECT desiredClientRect = {0, 0, 640, 480};
myCwnd->CalcWindowRect(&desiredClientRect,
ignoreScrollBars ? CWnd::adjustBorder : CWnd::adjustOutside);
// Win32 version
RECT desiredClientRect = {0, 0, 640, 480};
DWORD dwStyle = GetWindowLong(myHwnd, GWL_STYLE);
AdjustWindowRectEx(&desiredClientRect,
dwStyle,
(GetMenu(myHwnd) != NULL), // bMenu
GetWindowLong(myHwnd, GWL_EXSTYLE)); // dwExStyle
if(!ignoreScrollBars)
{
if(dwStyle & WS_HSCROLL)
desiredClientRect.right += GetSystemMetrics(SM_CXHSCROLL);
if(dwStyle & WS_VSCROLL)
desiredClientRect.bottom += GetSystemMetrics(SM_CXVSCROLL);
}