Click here to Skip to main content
15,881,803 members
Articles / Programming Languages / C#
Article

C# RangeBar control

Rate me:
Please Sign up or sign in to vote.
4.81/5 (21 votes)
8 Jul 2003 157.5K   3.6K   67   30
A control that combines two scrollbars for choosing two related values

Image 1

Introduction

If you want to give the user the possibility to define a number interval to set a two side threshold in an image processing program, then you can use two scrollbars, first for lower and second for upper limit. Further you have to catch changing events to prevent that lower limit is higher than the upper.

Wouldn't it be easier to have a control that combines two scrollbars?

The ZzzzRangeBar is a two button slide control for setting an integer number interval. If you push with a left click on a slide button it will marked and while mouse button is pressed you can move the slider left and right. Otherwise you can use the keys + and - to manipulate the slider position.

The control will throw two events. While left mouse button is pressed and the position of one slider has changed the event OnRangeChanging will generate and if you release mouse button, the event OnRangeChanged signals program that a new range was selected.

History

16 May 2002 first version of rangebar control

7 June 2003  enhancing control with vertical orientation and different scaling ticks options

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionMessage Closed Pin
14-Jul-19 5:03
compitionpoint14-Jul-19 5:03 
QuestionPerfect Example Pin
Yakov.Erlich15-Oct-18 20:21
Yakov.Erlich15-Oct-18 20:21 
Questionhow can i add one more thumb here to show actual position Pin
Le@rner12-Sep-17 21:10
Le@rner12-Sep-17 21:10 
QuestionLicense Pin
The Techsmith18-Apr-12 10:42
The Techsmith18-Apr-12 10:42 
AnswerRe: License Pin
Detlef Neunherz18-Apr-12 19:57
Detlef Neunherz18-Apr-12 19:57 
GeneralRe: License Pin
The Techsmith19-Apr-12 2:34
The Techsmith19-Apr-12 2:34 
Thank you very much Big Grin | :-D
GeneralRe: License Pin
Member 853650122-Jan-13 9:50
Member 853650122-Jan-13 9:50 
QuestionWill it be easy to change range bar to select a date range? Pin
agelospanagiotakis21-Sep-11 23:03
agelospanagiotakis21-Sep-11 23:03 
AnswerRe: Will it be easy to change range bar to select a date range? Pin
Detlef Neunherz22-Sep-11 2:23
Detlef Neunherz22-Sep-11 2:23 
GeneralRe: Will it be easy to change range bar to select a date range? Pin
agelospanagiotakis22-Sep-11 13:23
agelospanagiotakis22-Sep-11 13:23 
GeneralRe: Will it be easy to change range bar to select a date range? Pin
agelospanagiotakis22-Sep-11 23:52
agelospanagiotakis22-Sep-11 23:52 
GeneralOpen Source License Pin
apham9119-Mar-11 3:08
apham9119-Mar-11 3:08 
GeneralRe: Open Source License Pin
Member 77414959-Mar-11 21:16
Member 77414959-Mar-11 21:16 
GeneralMy vote of 5 Pin
suplik1-Jul-10 16:38
suplik1-Jul-10 16:38 
GeneralGreat Custom Control Pin
bsmisl2-Dec-09 22:23
bsmisl2-Dec-09 22:23 
GeneralRe: Great Custom Control Pin
Detlef Neunherz2-Dec-09 23:53
Detlef Neunherz2-Dec-09 23:53 
Generalnice Pin
Bassam Alugili27-Nov-08 8:47
Bassam Alugili27-Nov-08 8:47 
QuestionUsage of this control. Pin
vijaysubramaniam21-Jul-08 1:58
vijaysubramaniam21-Jul-08 1:58 
GeneralThank you, question. Pin
kalin811-Jan-06 3:56
kalin811-Jan-06 3:56 
GeneralThnx Pin
ngna12-Mar-04 4:30
ngna12-Mar-04 4:30 
Generalplz help me with running ur code Pin
rachel20302-Mar-04 6:01
rachel20302-Mar-04 6:01 
GeneralAdded ability to move entire range (both marks simultaneously) Pin
MtnBiknGuy23-Oct-03 14:44
MtnBiknGuy23-Oct-03 14:44 
GeneralRe: Added ability to move entire range (both marks simultaneously) Pin
Member 774149523-Oct-03 21:04
Member 774149523-Oct-03 21:04 
GeneralRe: Added ability to move entire range (both marks simultaneously) Pin
MtnBiknGuy26-Oct-03 4:06
MtnBiknGuy26-Oct-03 4:06 
GeneralRe: Added ability to move entire range (both marks simultaneously) Pin
steffen_dec20-Feb-12 3:19
steffen_dec20-Feb-12 3:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.