fix: minor fixes.

This commit is contained in:
rabbitism
2024-01-15 01:23:00 +08:00
parent f895ea6a89
commit d3c54f3088
2 changed files with 24 additions and 64 deletions

View File

@@ -449,11 +449,11 @@ public abstract class NumericUpDownBase<T>: NumericUpDown where T: struct, IComp
}
if (value.Value.CompareTo(max) > 0)
{
return Maximum;
return max;
}
if (value.Value.CompareTo(min) < 0)
{
return Minimum;
return min;
}
return value;
}
@@ -520,7 +520,7 @@ public abstract class NumericUpDownBase<T>: NumericUpDown where T: struct, IComp
if (_textBox!= null && !Equals(_textBox.Text, newText))
{
_textBox.Text = newText;
_textBox.CaretIndex = newText?.Length??0;
_textBox.CaretIndex = newText?.Length ?? 0;
}
}
}
@@ -609,7 +609,7 @@ public abstract class NumericUpDownBase<T>: NumericUpDown where T: struct, IComp
SetCurrentValue(ValueProperty, Clamp(value, Maximum, Minimum));
}
protected abstract bool ParseText(string? text, out T? number);
protected abstract bool ParseText(string? text, out T number);
protected abstract string? ValueToString(T? value);
protected abstract T Zero { get; }
protected abstract T? Add(T? a, T? b);