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 | 5185d70ddd14728576bafdfea267981baed88d84 (patch) | |
| tree | 28ecf610198dc524f927f953a952cbc7f1717498 /src/GraphicObjects/NumericControl.cs | |
| parent | 8d59e42e78db11afaf9b2f6530403a12b1d1926c (diff) | |
| parent | 28788991d650bc8ba29b9c2817dbb757129977e5 (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(); } |