An Original Idea

because all great software begins with an original idea

Flick Scrolling in Winforms

Posted by anoriginalidea on August 10, 2009

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 :

3 Responses to “Flick Scrolling in Winforms”

  1. Thierry said

    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

    • Hi,

      I’ve moved the code to a more reliable source and changed the link.

      Have Fun!

      Regards

      Julian

    • Thierry said

      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.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>