Reputation: 5729
I added a trackbar on a Winform project with C#.
mySlider.Minimum = 0;
mySlider.Maximum = 200;
mySlider.Value = 30;
mySlider.SmallChange = 10;
mySlider.LargeChange = 10;
mySlider.TickFrequency = 10;
I would like to be able to select only ten multiples value.
I don't found a solution in order to do this.
What's the best way please ?
Upvotes: 3
Views: 794
Reputation: 14059
Since the TrackBar
control hasn't any labels, you could use it for entering values and then multiply entered value by 10
. For instance:
mySlider.Minimum = 0;
mySlider.Maximum = 20;
mySlider.Value = 3;
mySlider.SmallChange = 1;
mySlider.LargeChange = 1;
mySlider.TickFrequency = 1;
But labels for the minimum and the maximum should display values multiplied by 10
.
And when entered value is requested, simply multiply it by 10
:
int someValue = mySlider.Value * 10;
Upvotes: 3