* UIDoubleUpDown, UIProcessBar, UITextBox: 小数位数统一改名为DecimalPlaces

This commit is contained in:
Sunny 2022-07-28 16:53:09 +08:00
parent d37b655c24
commit dc8b8a00a3
4 changed files with 9 additions and 38 deletions

View File

@ -133,16 +133,16 @@ namespace Sunny.UI
{ {
value = CheckMaxMin(value); value = CheckMaxMin(value);
_value = value; _value = value;
pnlValue.Text = _value.ToString("F" + Decimal); pnlValue.Text = _value.ToString("F" + decLength);
ValueChanged?.Invoke(this, _value); ValueChanged?.Invoke(this, _value);
} }
} }
private int decLength = 1; private int decLength = 1;
[DefaultValue(1), Browsable(false)] [Description("显示文字小数位数"), Category("SunnyUI")]
[Description("小数位数"), Category("SunnyUI")] [DefaultValue(1)]
public int Decimal public int DecimalPlaces
{ {
get => decLength; get => decLength;
set 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; private double step = 0.1;
[DefaultValue(0.1)] [DefaultValue(0.1)]
@ -314,7 +306,7 @@ namespace Sunny.UI
pnlColor = pnlValue.FillColor; pnlColor = pnlValue.FillColor;
pnlValue.FillColor = Color.White; pnlValue.FillColor = Color.White;
edit.TextAlign = HorizontalAlignment.Center; edit.TextAlign = HorizontalAlignment.Center;
edit.DecLength = Decimal; edit.DecLength = decLength;
edit.DoubleValue = Value; edit.DoubleValue = Value;
edit.BringToFront(); edit.BringToFront();
edit.Visible = true; edit.Visible = true;

View File

@ -227,15 +227,6 @@ namespace Sunny.UI
private int decimalCount = 1; private int decimalCount = 1;
[Description("显示文字小数位数"), Category("SunnyUI")]
[DefaultValue(1), Browsable(false)]
[Obsolete("请用DecimalPlaces代替。")]
public int DecimalCount
{
get => decimalCount;
set => decimalCount = Math.Max(value, 0);
}
/// <summary> /// <summary>
/// 设置主题样式 /// 设置主题样式
/// </summary> /// </summary>

View File

@ -754,24 +754,12 @@ namespace Sunny.UI
set => edit.Text = value; set => edit.Text = value;
} }
/// <summary>
/// 当InputType为数字类型时小数位数。
/// </summary>
[Description("当InputType为数字类型时小数位数。")]
[DefaultValue(2), Category("SunnyUI")]
[Browsable(false)]
public int DecLength
{
get => edit.DecLength;
set => edit.DecLength = Math.Max(value, 0);
}
[Description("浮点数,显示文字小数位数"), Category("SunnyUI")] [Description("浮点数,显示文字小数位数"), Category("SunnyUI")]
[DefaultValue(2)] [DefaultValue(2)]
public int DecimalPlaces public int DecimalPlaces
{ {
get => DecLength; get => edit.DecLength;
set => DecLength = value; set => edit.DecLength = Math.Max(value, 0);
} }
[DefaultValue(false)] [DefaultValue(false)]

View File

@ -444,7 +444,7 @@ namespace Sunny.UI
frm.TopMost = topMost; frm.TopMost = topMost;
frm.Style = style; frm.Style = style;
frm.Editor.Type = UITextBox.UIEditType.Double; frm.Editor.Type = UITextBox.UIEditType.Double;
frm.Editor.DecLength = decimals; frm.Editor.DecimalPlaces = decimals;
frm.Editor.DoubleValue = value; frm.Editor.DoubleValue = value;
frm.Text = UILocalize.InputTitle; frm.Text = UILocalize.InputTitle;
frm.Label.Text = desc; frm.Label.Text = desc;
@ -469,7 +469,7 @@ namespace Sunny.UI
frm.TopMost = topMost; frm.TopMost = topMost;
frm.Style = style; frm.Style = style;
frm.Editor.Type = UITextBox.UIEditType.Double; frm.Editor.Type = UITextBox.UIEditType.Double;
frm.Editor.DecLength = decimals; frm.Editor.DecimalPlaces = decimals;
frm.Editor.DoubleValue = value; frm.Editor.DoubleValue = value;
frm.Text = UILocalize.InputTitle; frm.Text = UILocalize.InputTitle;
frm.Label.Text = desc; frm.Label.Text = desc;