Click to See Complete Forum and Search --> : How to Get the actual point when clicked in a ScrollView ??


Kaps
May 11th, 1999, 08:20 AM
Hi,

I am using CScrollView and my intial window is not maximized. So when I scroll down and tries to click in the view area, then funtion OnLButtonDown() returns point relative to the visible window, I mean not the actual point of the full view.

Can you pls tell me the way out.

With best regards,
Kapil

Damir Cosic
May 11th, 1999, 10:36 AM
Something like this should work. If you have some zooming involved, you'll have to do some scaling too.

OnLButtonDown(UINT nFlags, CPoint point)
{

CPoint scrollPos = GetScrollPosition();
point.y += scrollPos.y;
point.x += scrollPos.x;
...
}

Hope this helps.

Damir