From dc8b8a00a304408d9c765c41a2c29376371a0044 Mon Sep 17 00:00:00 2001 From: Sunny Date: Thu, 28 Jul 2022 16:53:09 +0800 Subject: [PATCH] =?UTF-8?q?*=20UIDoubleUpDown,=20UIProcessBar,=20UITextBox?= =?UTF-8?q?:=20=E5=B0=8F=E6=95=B0=E4=BD=8D=E6=95=B0=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E6=94=B9=E5=90=8D=E4=B8=BADecimalPlaces?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SunnyUI/Controls/UIDoubleUpDown.cs | 18 +++++------------- SunnyUI/Controls/UIProcessBar.cs | 9 --------- SunnyUI/Controls/UITextBox.cs | 16 ++-------------- SunnyUI/Forms/UIFormHelper.cs | 4 ++-- 4 files changed, 9 insertions(+), 38 deletions(-) diff --git a/SunnyUI/Controls/UIDoubleUpDown.cs b/SunnyUI/Controls/UIDoubleUpDown.cs index db8d00f1..39a13a64 100644 --- a/SunnyUI/Controls/UIDoubleUpDown.cs +++ b/SunnyUI/Controls/UIDoubleUpDown.cs @@ -133,16 +133,16 @@ namespace Sunny.UI { value = CheckMaxMin(value); _value = value; - pnlValue.Text = _value.ToString("F" + Decimal); + pnlValue.Text = _value.ToString("F" + decLength); ValueChanged?.Invoke(this, _value); } } private int decLength = 1; - [DefaultValue(1), Browsable(false)] - [Description("小数位数"), Category("SunnyUI")] - public int Decimal + [Description("显示文字小数位数"), Category("SunnyUI")] + [DefaultValue(1)] + public int DecimalPlaces { get => decLength; set @@ -152,14 +152,6 @@ namespace Sunny.UI } } - [Description("显示文字小数位数"), Category("SunnyUI")] - [DefaultValue(1)] - public int DecimalPlaces - { - get => Decimal; - set => Decimal = value; - } - private double step = 0.1; [DefaultValue(0.1)] @@ -314,7 +306,7 @@ namespace Sunny.UI pnlColor = pnlValue.FillColor; pnlValue.FillColor = Color.White; edit.TextAlign = HorizontalAlignment.Center; - edit.DecLength = Decimal; + edit.DecLength = decLength; edit.DoubleValue = Value; edit.BringToFront(); edit.Visible = true; diff --git a/SunnyUI/Controls/UIProcessBar.cs b/SunnyUI/Controls/UIProcessBar.cs index c14b26a3..e1d3f52f 100644 --- a/SunnyUI/Controls/UIProcessBar.cs +++ b/SunnyUI/Controls/UIProcessBar.cs @@ -227,15 +227,6 @@ namespace Sunny.UI private int decimalCount = 1; - [Description("显示文字小数位数"), Category("SunnyUI")] - [DefaultValue(1), Browsable(false)] - [Obsolete("请用DecimalPlaces代替。")] - public int DecimalCount - { - get => decimalCount; - set => decimalCount = Math.Max(value, 0); - } - /// /// 设置主题样式 /// diff --git a/SunnyUI/Controls/UITextBox.cs b/SunnyUI/Controls/UITextBox.cs index 9a61e537..5dc91ea0 100644 --- a/SunnyUI/Controls/UITextBox.cs +++ b/SunnyUI/Controls/UITextBox.cs @@ -754,24 +754,12 @@ namespace Sunny.UI set => edit.Text = value; } - /// - /// 当InputType为数字类型时,小数位数。 - /// - [Description("当InputType为数字类型时,小数位数。")] - [DefaultValue(2), Category("SunnyUI")] - [Browsable(false)] - public int DecLength - { - get => edit.DecLength; - set => edit.DecLength = Math.Max(value, 0); - } - [Description("浮点数,显示文字小数位数"), Category("SunnyUI")] [DefaultValue(2)] public int DecimalPlaces { - get => DecLength; - set => DecLength = value; + get => edit.DecLength; + set => edit.DecLength = Math.Max(value, 0); } [DefaultValue(false)] diff --git a/SunnyUI/Forms/UIFormHelper.cs b/SunnyUI/Forms/UIFormHelper.cs index 99dcd3d4..aed90033 100644 --- a/SunnyUI/Forms/UIFormHelper.cs +++ b/SunnyUI/Forms/UIFormHelper.cs @@ -444,7 +444,7 @@ namespace Sunny.UI frm.TopMost = topMost; frm.Style = style; frm.Editor.Type = UITextBox.UIEditType.Double; - frm.Editor.DecLength = decimals; + frm.Editor.DecimalPlaces = decimals; frm.Editor.DoubleValue = value; frm.Text = UILocalize.InputTitle; frm.Label.Text = desc; @@ -469,7 +469,7 @@ namespace Sunny.UI frm.TopMost = topMost; frm.Style = style; frm.Editor.Type = UITextBox.UIEditType.Double; - frm.Editor.DecLength = decimals; + frm.Editor.DecimalPlaces = decimals; frm.Editor.DoubleValue = value; frm.Text = UILocalize.InputTitle; frm.Label.Text = desc;