Question GUI Framework Question

1218XD

New member
Joined
Feb 9, 2021
Messages
3
Programming Experience
Beginner
Is there any free GUI Framework with a slider similar to the one shown below?
6oZ6qQKY0d.gif
 
WPF will likely have a slider like that, or at least it will be easy enough to change its template to look like that.

WinForms may take some work to hide the thumb control that moves the slider. Alternatively, the scroll bar could just be adapted to hide the thumb.

jQuery UI will likely let you build one from one of its existing bar graphs.
 
WPF will likely have a slider like that, or at least it will be easy enough to change its template to look like that.

WinForms may take some work to hide the thumb control that moves the slider. Alternatively, the scroll bar could just be adapted to hide the thumb.

jQuery UI will likely let you build one from one of its existing bar graphs.
I've tried using a scroll bar as an alternative solution for this, but the thumb size is getting bigger whenever I lower the minimum and maximum value and it just doesn't look good.
 
With your response about the scrollbar, I assuming you are trying to implement this within your WinForms app. If this assumption is incorrectly, please tell us what your target platform is so that we don't waste time discussing/exploring options if the result will not be applicable.
 
With your response about the scrollbar, I assuming you are trying to implement this within your WinForms app. If this assumption is incorrectly, please tell us what your target platform is so that we don't waste time discussing/exploring options if the result will not be applicable.
Yes, I am trying to implement this in my WinForms application. I had to provide this information in the thread before creating it, sorry.
 
Moving thread to WinForms...
 
If you've already tried the scrollbar, it maybe faster to learn from this CodeProject where he rolled his own slider control because he was unhappy with the built in one in WinForms.

 
If you want to create something yourself you need to handle MouseMove and Paint events. On a very basic level it can be done like this:
C#:
private int sliderWidth;
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
    if (Control.MouseButtons == MouseButtons.Left)
    {
        sliderWidth = e.X;
        pictureBox1.Refresh();
    }
}

private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
    var rct = pictureBox1.ClientRectangle;
    rct.Inflate(-4, -4);
    rct.Width = Math.Min(sliderWidth, rct.Width);
    e.Graphics.FillRectangle(Brushes.Orange, rct);
}
Just using a PictureBox control as drawing surface here for the example, one would more likely put this in a UserControl and add properties like Value, Min and Max similar to ProgressBars or NumericUpDowns
 
Back
Top Bottom