Question Hour and minute slider

Valakik

Member
Joined
Nov 8, 2020
Messages
12
Programming Experience
Beginner
Hello
I find on the internet many slider on the internet from 0-10 and so on but I don't find any for hour and minute.
I am trying to make something like this (jquery): https://codepen.io/caseymhunt/pen/kertA

I don't know how I can make in C# winform. I just need to able select beginning and ending of the hour and minute. When moving the slider then increasing and decreasing with 15 minutes.
Is there an open source for this or how I can make this? The design can be basic too, I just need the function to work.
I don't have any idea how to make this possible.

Thank you in advance all of the answers.
 
Most of the built in WinForms controls are what you find in Windows XP era. (Although there are some packages you can try using that lets you accesses what has been added to the OS since then. ) That kind of slider that you want is definitely after that time. You'll have to roll your own. It's not that hard.
 
If it wouldn't be hard for me then I wouldn't ask, I think. :unsure:
I am just a beginner level with the C#. Most of the time I spent on the web development.
I guess, I need go to search more on the google.

Well either way thank you for responding to my topic.
:)
 
I wrote a very basic one last night, attached here. It looks like this (used a label in form to show time)
1617983871500.png

It could be used for any range selection, but it was modeled like the jQuery one with values based on minutes in a day 0-1440.
testing code:
private void rangeSlider1_ValuesChanged(object sender, EventArgs e)
{
    Debug.WriteLine($"Min {rangeSlider1.Min} Max {rangeSlider1.Max} MinValue {rangeSlider1.MinValue} MaxValue {rangeSlider1.MaxValue}");

    var dtmin = DateTime.Today.AddMinutes(rangeSlider1.MinValue);
    var dtmax = DateTime.Today.AddMinutes(rangeSlider1.MaxValue);
    label1.Text = $"{dtmin:HH:mm} to {dtmax:HH:mm}";
}
(edit: small bug fix + orientation + reverse range + borders)
 

Attachments

  • RangeSlider.zip
    1.9 KB · Views: 11
Last edited:
Back
Top Bottom