Click here to Skip to main content
Licence 
First Posted 15 May 2002
Views 104,211
Bookmarked 62 times

C# RangeBar control

By | 8 Jul 2003 | Article
A control that combines two scrollbars for choosing two related values

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

About the Author

Detlef Neunherz

Web Developer

Germany Germany

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionLicense PinmemberThe Techsmith10:42 18 Apr '12  
AnswerRe: License PinmemberDetlef Neunherz19:57 18 Apr '12  
GeneralRe: License PinmemberThe Techsmith2:34 19 Apr '12  
QuestionWill it be easy to change range bar to select a date range? Pinmemberagelospanagiotakis23:03 21 Sep '11  
AnswerRe: Will it be easy to change range bar to select a date range? PinmemberDetlef Neunherz2:23 22 Sep '11  
GeneralRe: Will it be easy to change range bar to select a date range? Pinmemberagelospanagiotakis13:23 22 Sep '11  
GeneralRe: Will it be easy to change range bar to select a date range? Pinmemberagelospanagiotakis23:52 22 Sep '11  
GeneralOpen Source License Pinmemberapham9113:08 9 Mar '11  
GeneralRe: Open Source License PinmemberMember 774149521:16 9 Mar '11  
GeneralMy vote of 5 Pinmembersuplik16:38 1 Jul '10  
GeneralGreat Custom Control Pinmemberbsmisl22:23 2 Dec '09  
GeneralRe: Great Custom Control PinmemberDetlef Neunherz23:53 2 Dec '09  
Generalnice PinmemberBassam Alugili8:47 27 Nov '08  
QuestionUsage of this control. Pinmembervijaysubramaniam1:58 21 Jul '08  
GeneralThank you, question. Pinmemberkalin83:56 11 Jan '06  
GeneralThnx Pinmemberngna4:30 12 Mar '04  
Generalplz help me with running ur code Pinmemberrachel20306:01 2 Mar '04  
GeneralAdded ability to move entire range (both marks simultaneously) PinmemberMtnBiknGuy14:44 23 Oct '03  
GeneralRe: Added ability to move entire range (both marks simultaneously) PinsussDetlef Neunherz21:04 23 Oct '03  
GeneralRe: Added ability to move entire range (both marks simultaneously) PinmemberMtnBiknGuy4:06 26 Oct '03  
GeneralRe: Added ability to move entire range (both marks simultaneously) Pinmembersteffen_dec3:19 20 Feb '12  
GeneralVS 2002 PinmemberMtnBiknGuy9:18 23 Oct '03  
GeneralVery good, but PinmemberGary Sui12:59 28 Jun '03  
GeneralRe: Very good, but PinsussAnonymous0:49 3 Jul '03  
GeneralMinor improvments Pinmemberrbarb0:14 20 May '02  
Hello,
 
This is a very good sample of wich can be doing with C#. I have meade some minor improvments to complete the keyboard navigation interface:
 
private void OnEnter(object sender, System.EventArgs e)
{
ActiveMark = ActiveMarkType.left;
Invalidate(true);
}
 
Also, your OnLeave() event managet is missing the Invalidate(true). The last one modification is on the first lines of OnKeyPress event:
 
private void OnKeyPress(object sender,Windows.Forms.KeyPressEventArgs e)
{
if(e.KeyChar.ToString().ToUpper()=="L")
ActiveMark=ActiveMarkType.left;
 
if(e.KeyChar.ToString().ToUpper()=="R")
ActiveMark=ActiveMarkType.right ;
 
With this little changes the control is completly usable with keyboard only.
 


 
Saludos,
Rafael Barbera

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

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

Permalink | Advertise | Privacy | Mobile
Web03 | 2.5.120529.1 | Last Updated 9 Jul 2003
Article Copyright 2002 by Detlef Neunherz
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid