private void ValueTrackBar_Scroll(object sender, EventArgs e) { double percentage = (double)ValueTrackBar.Value / ValueTrackBar.Maximum; Value = MathPlus.Lerp(MinValue, MaxValue, percentage); ValueNumericUpDown.Value = (decimal)Value; }
void UpdateValueTrackBar() { double tValue = (MathPlus.Lerp(0, 1, (1 - (MaxValue - Value) / (MaxValue - MinValue)))); if (tValue > 1) { tValue = 1; } if (tValue < 0 || double.IsNaN(tValue)) { tValue = 0; } ValueTrackBar.Value = (int)(tValue * 1000); }