GetScrollPosition...how do you interpret the point?
Posted on 2004-08-23
Hi. I am trying to do something very simple. I have a CScrollView, and I've made my document size 500x500. When I scroll the view vertically and then click in it, I write to the view at two different points -- one where I clicked and one at the y-coordinate of the scrollPosition Here is the code:
void CMyScrollView::OnLButtonDown(UINT nFlags, CPoint point)
CPoint scrollPos = GetScrollPosition();
CDC *pDC = GetDC();
pDC->TextOut(0, point.y, "point");
pDC->TextOut(0, scrollPos.y, "scrPos");
The problem is that when I write to scrollPos.y, it consistently writes at a point below the top of the thumb in the scroll bar. What does scrollPos.y really represent? Is it the top of the thumb, bottom of the thumb, middle of the thumb, etc...? Do I need to do some more math on the scroll position or is the scroll position some other point on the scroll bar? Thanks.