void CScrollWnd::CalcWindowRect(LPRECT lpClientRect, UINT nAdjustType) { if (nAdjustType == adjustOutside) { // allow for special client-edge style ::AdjustWindowRectEx(lpClientRect, 0, FALSE, GetExStyle()); if (m_nMapMode != MM_SCALETOFIT) { // if the Wnd is being used in-place, add scrollbar sizes // (scollbars should appear on the outside when in-place editing) CSize sizeClient( lpClientRect->right - lpClientRect->left, lpClientRect->bottom - lpClientRect->top); CSize sizeRange = m_totalDev - sizeClient; // > 0 => need to scroll // get scroll bar sizes (used to adjust the window) CSize sizeSb; GetScrollBarSizes(sizeSb); // adjust the window size based on the state if (sizeRange.cy > 0) { // vertical scroll bars take up horizontal space lpClientRect->right += sizeSb.cx; } if (sizeRange.cx > 0) { // horizontal scroll bars take up vertical space lpClientRect->bottom += sizeSb.cy; } } } else { // call default to handle other non-client areas ::AdjustWindowRectEx(lpClientRect, GetStyle(), FALSE, GetExStyle() & ~(WS_EX_CLIENTEDGE)); } }
//**************************************************************************** void CBCGPDialogBar::UpdateScrollBars() { #ifndef _BCGSUITE_ if(GetSafeHwnd() == NULL || m_scrollSize == CSize(0, 0)) { return; } if (m_bUpdateScroll) { return; } m_bUpdateScroll = TRUE; CRect rectClient; GetClientRect(rectClient); CSize sizeClient(rectClient.Size()); CSize sizeRange (m_scrollSize - sizeClient); CPoint ptScroll (m_scrollPos); ASSERT(ptScroll.x >= 0 && ptScroll.y >= 0); int nScrollButtonSize = GetScrollButtonSize(); BOOL bNeedH = sizeRange.cx > 0; if (!bNeedH) { ptScroll.x = 0; sizeRange.cx = 0; } else { if (ScrollHorzAvailable (TRUE) && ScrollHorzAvailable (FALSE)) { sizeRange.cx -= nScrollButtonSize; } } BOOL bNeedV = sizeRange.cy > 0; if (!bNeedV) { ptScroll.y = 0; sizeRange.cy = 0; } else { if (ScrollVertAvailable (TRUE) && ScrollVertAvailable (FALSE)) { sizeRange.cy -= nScrollButtonSize; } } if (sizeRange.cx > 0 && ptScroll.x >= sizeRange.cx) { ptScroll.x = sizeRange.cx; } if (sizeRange.cy > 0 && ptScroll.y >= sizeRange.cy) { ptScroll.y = sizeRange.cy; } if (sizeRange.cx <= nScrollButtonSize) { sizeRange.cx = 0; } if (sizeRange.cy <= nScrollButtonSize) { sizeRange.cy = 0; } m_scrollRange = sizeRange; ScrollClient(CSize(m_scrollPos.x - ptScroll.x, m_scrollPos.y - ptScroll.y)); CalcScrollButtons (); m_bUpdateScroll = FALSE; #endif }