private static decimal LimitValueByBounds(decimal newValue, SpinnerControl control) { newValue = Math.Max(control.Minimum, Math.Min(control.Maximum, newValue)); // then ensure the number of decimal places is correct. newValue = Decimal.Round(newValue, control.DecimalPlaces); return(newValue); }
private static decimal LimitValueByBounds(decimal newValue, SpinnerControl control) { newValue = Math.Max(control.Minimum, Math.Min(control.Maximum, newValue)); // then ensure the number of decimal places is correct. newValue = Decimal.Round(newValue, control.DecimalPlaces); return newValue; }