Getting Started with Windows Forms Range Slider

10 Oct 20223 minutes to read

Assembly deployment

Refer to the control dependencies section to get the list of assemblies or details of NuGet package that needs to be added as reference to use the control in any application.

Click NuGet Packages to learn how to install nuget packages in Windows Forms application.

Add RangeSlider control via designer

  1. Create a new Windows Forms project in Visual Studio to display the RangeSlider control with dual thumb and highlight the selected range.

  2. The RangeSlider control can be added to an application by dragging it from the toolbox to a designer view. The following dependent assemblies will be added automatically:

  • Syncfusion.Grid.Base
  • Syncfusion.Grid.Windows
  • Syncfusion.Shared.Base
  • Syncfusion.Shared.Windows
  • Syncfusion.Tools.Base
  • Syncfusion.Tools.Windows

Windows Forms range slider control added by designer

Add RangeSlider control via code

To add the control manually in C#, follow the given steps:

  1. Create a C# or VB application via Visual Studio.

  2. Add the following references to the project:

  • Syncfusion.Grid.Base
  • Syncfusion.Grid.Windows
  • Syncfusion.Shared.Base
  • Syncfusion.Shared.Windows
  • Syncfusion.Tools.Base
  • Syncfusion.Tools.Windows
  1. Include the required namespace.

    using Syncfusion.Windows.Forms.Tools;
    Imports Syncfusion.Windows.Forms.Tools
  2. Create an instance of RangeSlider, and add it to the form.

    RangeSlider rangeSlider1 = new RangeSlider();
    rangeSlider1.ShowLabels = true;
    this.Controls.Add(rangeSlider1);
    Dim rangeSlider1 As RangeSlider = New RangeSlider
    rangeSlider1.ShowLabels = True
    Me.Controls.Add(rangeSlider1)

wf range slider control value range

Minimum and maximum values

You can set the minimum and maximum values programmatically using the SliderMin and SliderMax properties of RangeSlider.

rangeSlider1.SliderMin = 4;

rangeSlider1.SliderMax = 7;
rangeSlider1.SliderMin = 4

rangeSlider1.SliderMax = 7

wf range slider control value range

Horizontal and vertical orientations

You can change the layout of range slider to horizontal or vertical by setting the orientation property of RangeSlider.

rangeSlider.Orientation=Orientation.Vertical;
rangeSlider.Orientation=Orientation.Vertical

Horizontal

wf range slider control horizontal orientation

Vertical

wf range slider control horizontal orientation