-
June 8th, 2005, 06:37 AM
#1
Calculate scroll shift in pixels.
Hi
I have a listctrl with scrollbar. When user scroll i get message WM_HSCROLL. Now i want to know on how many pixels image is shifted. How can i calculate it?
I need it to scroll another window with same scrollbar.So if i calculate shift i can use ScrollWindow.
-
June 8th, 2005, 06:51 AM
#2
Re: Calculate scroll shift in pixels.
take a look at ::GetScrollBarInfo(...) it might help you.
in the SCROLLBARINFO struct you have all the information about thr scrolling.
if i helped dont forget to rate :-)
Cheers
-
June 8th, 2005, 06:57 AM
#3
Re: Calculate scroll shift in pixels.
Read the following article from MSDN
Using scrollbars
Have a look at the example in this article for scrolling a bitmap.
-
June 8th, 2005, 07:26 AM
#4
Re: Calculate scroll shift in pixels.
i have already read this articles. But us i understand each time programmer definr shift in pixels. In text shift relatively to text width,in bitmap to simply in pixels.
And my question was how to determinate this values in pixels. If folow this articles it is imposible,am i right?
-
June 8th, 2005, 07:54 AM
#5
Re: Calculate scroll shift in pixels.
I'm not sure I understand what you want.
If you want to capture notifications for a scrollbar from a control you don't manage yourself (i.e. for which you can't SetScrollInfo to pixel units) this won't be possible, in general. Note that not every scroll action will result in actually scrolling the list contents a number of pixels. The link between scrollpos and the image is arbitrarily defined by the control designer.
-
June 8th, 2005, 09:45 AM
#6
Re: Calculate scroll shift in pixels.
It seems problem was solved.
I calculate number of pixels on which i have to scroll.
I take all window size(not only visible,but all) and all scrollbar range. And devide them. So i get number of pixel per scroll unit. Then i get number of step and multiply by pixel per step.
One problem is then ScrollWindow need device units and i have pixels. Is ot the same?
-
June 9th, 2005, 06:15 AM
#7
Re: Calculate scroll shift in pixels.
Originally Posted by TOMNKZ
One problem is then ScrollWindow need device units and i have pixels. Is ot the same?
Same thing, only the origin point may differ
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|