- ViewStart(&m_ViewStartX, &m_ViewStartY);
- SetScrollbars(X_SCROLL_PAGE, Y_SCROLL_PAGE,
- max.x / X_SCROLL_PAGE + 1, max.y / Y_SCROLL_PAGE + 1,
- m_ViewStartX, m_ViewStartY,
- true);
-
+ bool done = FALSE;
+ if(max.x < X_SCROLL_PAGE && m_hasHScrollbar)
+ {
+ SetScrollbars(0,-1,0,-1,0,-1,true);
+ m_hasHScrollbar = FALSE;
+ done = TRUE;
+ }
+ if(max.y < Y_SCROLL_PAGE && m_hasVScrollbar)
+ {
+ SetScrollbars(-1,0,-1,0,-1,0,true);
+ m_hasVScrollbar = FALSE;
+ done = TRUE;
+ }
+ if(! done &&
+// (max.x > X_SCROLL_PAGE || max.y > Y_SCROLL_PAGE)
+ (max.x > size.x - X_SCROLL_PAGE|| max.y > size.y - Y_SCROLL_PAGE)
+ )
+ {
+ GetViewStart(&m_ViewStartX, &m_ViewStartY);
+ SetScrollbars(X_SCROLL_PAGE,
+ Y_SCROLL_PAGE,
+ max.x / X_SCROLL_PAGE + 2,
+ max.y / Y_SCROLL_PAGE + 2,
+ m_ViewStartX,
+ m_ViewStartY,
+ true);
+ m_hasHScrollbar =
+ m_hasVScrollbar = true;
+// ScrollToCursor();
+ }
+