Slider needs a Direction property.
TrackBar control increases the value when the mouse wheel is moved up, while Slider decreases it. It needs a property that would change this behavior to the opposite.
Solved. Now I hope leo to merge it 😁
Thanks, it also lacks the property of adjusting the value change step. To be able to set the scrolling step different from the one set in the system. Something like that:
public enum Directions { Normal, Reverse }
protected override void OnMouseWheel(MouseEventArgs e)
{
int scrollLines = SystemInformation.MouseWheelScrollLines;
Value += e.Delta / 40 / scrollLines * StepChange * (ScrollDirection == Directions.Normal ? 1 : -1);
Value = Math.Clamp(Value, RangeMin, RangeMax);
onValueChanged?.Invoke(this, Value);
}
[DefaultValue(2)]
[Category("Material Skin")]
[Description("Define control step change value")]
public int StepChange
{
get => stepChange;
set => stepChange = Math.Clamp(value, 1, RangeMax);
}
[DefaultValue(Directions.Normal)]
[Category("Material Skin")]
[Description("Define control direction change value with mouse wheel")]
public Directions ScrollDirection { get; set; }
Make a PR please and I will delete mine.
@valimaties, judging by this post, the edits will probably never be accepted.
@valimaties, judging by this post, the edits will probably never be accepted.
You can take a look at this project. I will add your changes as PR in a moment.