Results 1 to 34 of 34

Thread: [WIP] Double TrackBar

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    [WIP] Double TrackBar

    Hi,

    I needed a double TrackBar control for my project (one where the user can set a minimum and maximum value, for example) so I decided to create my own.

    It basically does anything the real TrackBar does as well, except different track styles and vertical orientation (still in my TODO list...)

    Screenshot:


    It works just like the normal TrackBar, the user can grab one of the handles and move it to a different value. My code uses the TrackBarRenderer class to draw the ticks and the grab handles so it should look just like the ordinary TrackBar control, whatever system theme you are using.


    Update 1:
    Implemented some changes:
    • Events ValueChanged, LeftValueChanged and RightValueChanged, raised when the position of a thumb changes. ValueChanged is raised for either thumb, while LeftValueChanged and RightValueChanged obviously are only raised when the corresponding thumb position changes.
    • Scrolling the mousewheel when a thumb is selected changes the position of that thumb, similar to the normal TrackBar control.
    • SelectedThumb property that returns the thumb (Left or Right) that was focused (or 'used') last. This is used by the scrolling support to determine which thumb to scroll.
    • Bugfix: thumbs can no longer move to the same position to avoid not being able to drag them anymore.




    Important: I am also using a custom designer so you can move the handles during design-time as well as during run-time. Because of this you will need to add a reference to System.Design in order to compile the code.

    NEW:
    I've now also uploaded a version without the designer, so you no longer have to reference System.Design. This allows you to use the Client Profile frameworks (which don't include System.Design). If you don't need or don't want the design-time dragging, you can use the 'No designer' version.



    Here's a few things (that I can think of) that this DoubleTrackBar control doesn't have (yet), which the normal TrackBar does have:
    • Multiple styles (such as double tickbars, horizontal vs vertical layout, etc)
    • Probably more...


    As I said, I might implement that at a later time, so this is still a work in progress.

    Enjoy!
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width