Range Slider control included with DotNetBar for WinForms provides you with ability to input numerical range selection in your application. With its default settings control looks like this:

DotNetBar for WinForms Range Slider Control

RangeSlider supports the vertical orientation by setting property SliderOrientation=Vertical:
DotNetBar RangeSlider Vertical Orientation

The possible selection range is set through Minimum and Maximum properties. Selected range is returned by Value property which is of RangeValue type. That means to access minimum and maximum values you use code like this:


// Accessing minimum and maximum values
int rangeMin, rangeMax;
rangeMin = rangeSlider1.Value.Min;
rangeMax = rangeSlider1.Value.Max;


' Accessing minimum and maximum values
Dim rangeMin as Integer
Dim rangeMax as Integer
rangeMin = rangeSlider1.Value.Min
rangeMax = rangeSlider1.Value.Max

To set the range value use code like this, note that RangeValue type constructor accepts minimum and maximum value range:


// Setting range value
rangeSlider1.Value = new RangeValue(3,7);


' Setting range value
rangeSlider1.Value = new RangeValue(3,7)

As user changes the range values ValueChanging and ValueChanged events are being fired. ValueChanging event allows you inspect the new range values before they are reflected by Value property and it also allows you to cancel the changes by setting RangeSliderValueChangingEventArgs.Cancel=true. Also note that ValueChanged event arguments can be cast to EventSourceArgs type which provides information about the source of the event (mouse, keyboard or code).

MinimumAbsoluteRange property provides you with quick way to set minimum range that user can select. Absolute range is defined as Abs(Value.Max-Value.Min) and this property setting applies to user performed selection through mouse only.

Tick marks by default are positioned below the range slider buttons, but that can be changed by setting TicksPosition property.

Images can be used instead of system range buttons. Set MinRangeSliderImage and MaxRangeSliderImage to custom images to use as slider buttons. Then set RangeButtonSize to the size of the image. Both images should have same size. Following image shows RangeSlider with custom images as range buttons:

DotNetBar for WinForms Range Slider control with custom images

While range is changed using mouse RangeSlider control will display tooltip which indicates current range. Following image shows that tooltip:

DotNetBar RangeSlider Current Value Tooltip

ShowRangeTooltip property indicates whether control shows tooltip when range value is changed. RangeTooltipFormat property controls the format of the tooltip. By default this is set to: “Min: {0} – Max: {1}”. “{0}” represents the range min value and “{1}” represents the range max value. You can set this property to anything you want.

By default RangeSlider indicates current selection range using green color. This can be changed by setting RangeValueColor property as shown below which paints range value red:

DotNetBar for WinForms RangeSlider Control with custom range color

All RangeSlider control colors are taken from Office2007ColorTable.RangeSlider object. So if you need to change any colors for all RangeSlider controls you change properties on Office2007ColorTable.RangeSlider object. Read this KB article for how to: http://www.devcomponents.com/kb2/?p=791