After releasing the mouse button, the image scrolling coninues while decelerating slowly, simulating the presence of inertia. The level of the deceleration depends on the momentum the mouse cursor obtains at the button release.
The code is based on custom GDI+ class. Download the class module first and save it in gdiplus.prg file.
Otherwise use any wide image, preferrably 24-bit bitmap. I have no explanation yet, but the code sample works a bit different with PNG, JPEG, and 16-bit bitmaps. Even when they are directly converted from an original 24-bit bitmap file.
Visualization is implemented for the boundaries and the relative position.
choose ticking frequency close to 16.7 msec (targeting 60 fps)
on each tick decrease the speed by 5%
stop scrolling either after a certain number of ticks or when the speed gets below a specified limit
Also called Kinetic Scrolling.
* * * 2013-December
I am working on a prototype of mouse-oriented ListView control. It will implement inertial scrolling, simple page flipping, ownerdraw items and more.
Most likely the final control will be an ActiveX control. VCX or PRG version is also feasible. I did some prototyping in VFP using GDI+ class library with good results.
The content of the control -- uniform-size items -- is positioned in rows and columns, and can be scrolled either vertically or horizontally.
Two modes of scrolling are available. When the free scrolling is selected, the control moves its content matching the moves of the cursor. While selecting the page flipping makes the control display a specified number of rows and columns with fluid transition from page to page.