diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-10-30 19:39:53 +0200 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-10-30 19:39:53 +0200 |
| commit | 882652abf66dadccbec62dfa478547f18b343fc8 (patch) | |
| tree | 8860eee422aeae37477306bdb1aa8598f8c287e4 /Samples/common/src/MyNumericControl.cs | |
| parent | 2866fa7335eabc4371cb6909348a8db688c9f59d (diff) | |
| parent | a4367fb29faf7ee987b937e2397359a6020f25b9 (diff) | |
Merge branch 'FileDialogImprove'
Diffstat (limited to 'Samples/common/src/MyNumericControl.cs')
| -rw-r--r-- | Samples/common/src/MyNumericControl.cs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Samples/common/src/MyNumericControl.cs b/Samples/common/src/MyNumericControl.cs new file mode 100644 index 00000000..38e162a3 --- /dev/null +++ b/Samples/common/src/MyNumericControl.cs @@ -0,0 +1,46 @@ +//Tutorial +using Crow; + +namespace MyNumericControl { + public class MyNumericControl : TemplatedControl { + protected double actualValue, minValue, maxValue; + public double Minimum { + get => minValue; + set { + if (minValue == value) + return; + minValue = value; + if (Value < minValue) + Value = minValue; + NotifyValueChangedAuto (minValue); + } + } + public double Maximum { + get => maxValue; + set { + if (maxValue == value) + return; + maxValue = value; + NotifyValueChangedAuto (maxValue); + + if (Value > maxValue) + Value = maxValue; + + } + } + public virtual double Value { + get => actualValue; + set { + if (actualValue == value) + return; + if (value < minValue) + actualValue = minValue; + else if (value > maxValue) + actualValue = maxValue; + else + actualValue = value; + NotifyValueChangedAuto (actualValue); + } + } + } +}
\ No newline at end of file |