diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2017-11-05 23:02:49 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2017-11-05 23:02:49 +0100 |
| commit | 56e577d4ad9c260d401f9125587d25d76bddce69 (patch) | |
| tree | 7dbd6a5627f785aa2210dd27d84a6208b2a0c5e2 /src/GraphicObjects/NumericControl.cs | |
| parent | e0afea21eafc13f31cf649eadce30d1a8f5e867d (diff) | |
| parent | a34e76aabe4dfa2bbadae93d05386cb41ff51e30 (diff) | |
merge
Diffstat (limited to 'src/GraphicObjects/NumericControl.cs')
| -rw-r--r-- | src/GraphicObjects/NumericControl.cs | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/GraphicObjects/NumericControl.cs b/src/GraphicObjects/NumericControl.cs index 9b511831..8ab60edb 100644 --- a/src/GraphicObjects/NumericControl.cs +++ b/src/GraphicObjects/NumericControl.cs @@ -44,10 +44,24 @@ namespace Crow #region private fields double _actualValue, minValue, maxValue, smallStep, bigStep; + int _decimals; #endregion #region public properties - [XmlAttributeAttribute()][DefaultValue(0.0)] + [XmlAttributeAttribute][DefaultValue(2)] + public int Decimals + { + get { return _decimals; } + set + { + if (value == _decimals) + return; + _decimals = value; + NotifyValueChanged("Decimals", _decimals); + RegisterForGraphicUpdate(); + } + } + [XmlAttributeAttribute][DefaultValue(0.0)] public virtual double Minimum { get { return minValue; } set { @@ -59,7 +73,7 @@ namespace Crow RegisterForRedraw (); } } - [XmlAttributeAttribute()][DefaultValue(100.0)] + [XmlAttributeAttribute][DefaultValue(100.0)] public virtual double Maximum { get { return maxValue; } @@ -72,7 +86,7 @@ namespace Crow RegisterForRedraw (); } } - [XmlAttributeAttribute()][DefaultValue(1.0)] + [XmlAttributeAttribute][DefaultValue(1.0)] public virtual double SmallIncrement { get { return smallStep; } @@ -85,7 +99,7 @@ namespace Crow RegisterForRedraw (); } } - [XmlAttributeAttribute()][DefaultValue(5.0)] + [XmlAttributeAttribute][DefaultValue(5.0)] public virtual double LargeIncrement { get { return bigStep; } @@ -98,7 +112,7 @@ namespace Crow RegisterForRedraw (); } } - [XmlAttributeAttribute()][DefaultValue(0.0)] + [XmlAttributeAttribute][DefaultValue(0.0)] public double Value { get { return _actualValue; } @@ -114,6 +128,8 @@ namespace Crow else _actualValue = value; + _actualValue = Math.Round (_actualValue, _decimals); + NotifyValueChanged("Value", _actualValue); RegisterForGraphicUpdate(); } |