(MFC Question) What’s the best way to determine the current displayed client area in a CScrollView? I only need the size of the visible portion, so GetClientRect() won’t work here.
(MFC Question) What’s the best way to determine the current displayed client area in
Share
You do need to use GetClientRect(), but I think you’re asking the wrong question. It is not so that in a scrolled view there is a very big client window that is physically scrolled. Instead, when you scroll, the DC’s viewportext and mapping mode are adjusted, which make it seem like your view is bigger than it actually is. So, if you want to draw a line from the top left corner of the bottom right corner of the current viewport, you do need GetViewPortOrg() and GetViewportExt(). If these return the wrong values, something is wrong in your use of CScrollView. Did you call SetScrollSizes()?