Flick Scrolling in Winforms

Standard

image

 

In the article A Simple Scroll Controller for Winforms I mentioned that I was working on a FlickScrolling framework for Winforms.

I finished a version of this code a couple of months ago and it seems to work well.  

The code never went into production because I think that Windows 7 will provide this functionality automatically for winforms applications. 

Nevertheless, some people have showed an interest in what I came up with, so I’m posting it here for your edification.  I hope someone finds it useful.

Usage

To use, simply instantiate the “ApplicationFlickScrolling” class, passing in the datatypes of the container controls you wish to scroll.

For example:

Private Shared moApplicationFlick As New ApplicationFlickScrolling(GetType(Panel))

To switch it on and off, used the “Enabled” property:

moApplicationFlick.Enabled = True

That’s it!

 

The Implementation

image

The code consists of 3 classes:

  • ApplicationFlickScrolling to act as the master controller class
  • ApplicationMouseEvents class for detecting mouse events
  • FlickDetector for detecting simple gestures
  • ScrollController for performing elastic-style easing of scrolling

Improvements

If I’d have continued developing this I would have modified ScrollController to use “proper” easing functions. 

 

 
Note: The usual disclaimers apply for this code, which has been given freely to help others learn and is not intended for usage in your business application or for running a nuclear facility.
Share this post :
Advertisements

4 responses »

  1. Hi,

    I’ve been looking for that kind of code for quite a while ! Seems really interesting, but apparently, the downloading link is dead… Could you put it up again ?

    Thanks a lot

    • Thanks a lot !

      I’ve played a bit with it this morning, i’m trying to implement it to be able to scroll a datagridview. I tried puting the dgv in a panel, which worked fine, but it’s not fast enough (it’s a huuuge datagridview) plus it’s messing with some of my other functions.

      But the main thing is : the animation ! And that’s kinda cool. 😉

      Nice work !

      T.

  2. I just downloaded the demo and I’ve setup an Iphone frame which looks real nice. inhere I would like to take a telerik radlistbox and try to have it look like the iphone menu. thogether with te scrolling code from your project, Must be nice 🙂

    I’ve been struggling a bit with the looks of the radlistbox though. as soon as i have that setup, I hope the scrolling will go smooth.

    Thanx in advance..

    Rick

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s