diff --git a/Bin/net40/SunnyUI.Demo.exe b/Bin/net40/SunnyUI.Demo.exe index 5e3853f0..bd40b5b5 100644 Binary files a/Bin/net40/SunnyUI.Demo.exe and b/Bin/net40/SunnyUI.Demo.exe differ diff --git a/Bin/net40/SunnyUI.dll b/Bin/net40/SunnyUI.dll index cc1ebdc5..f6ab87fd 100644 Binary files a/Bin/net40/SunnyUI.dll and b/Bin/net40/SunnyUI.dll differ diff --git a/Bin/net5.0-windows/SunnyUI.dll b/Bin/net5.0-windows/SunnyUI.dll index 365a4bad..cfb050fa 100644 Binary files a/Bin/net5.0-windows/SunnyUI.dll and b/Bin/net5.0-windows/SunnyUI.dll differ diff --git a/Bin/net5.0-windows/ref/SunnyUI.dll b/Bin/net5.0-windows/ref/SunnyUI.dll index 4b04521d..0152cd59 100644 Binary files a/Bin/net5.0-windows/ref/SunnyUI.dll and b/Bin/net5.0-windows/ref/SunnyUI.dll differ diff --git a/Bin/netcoreapp3.1/SunnyUI.dll b/Bin/netcoreapp3.1/SunnyUI.dll index bc7ab249..09cf1a16 100644 Binary files a/Bin/netcoreapp3.1/SunnyUI.dll and b/Bin/netcoreapp3.1/SunnyUI.dll differ diff --git a/SunnyUI.Demo/Forms/FDialogs.cs b/SunnyUI.Demo/Forms/FDialogs.cs index 3a0841be..56ad74cc 100644 --- a/SunnyUI.Demo/Forms/FDialogs.cs +++ b/SunnyUI.Demo/Forms/FDialogs.cs @@ -45,7 +45,7 @@ namespace Sunny.UI.Demo private void btnStatus2_Click(object sender, EventArgs e) { - ShowStatusForm(100, "数据加载中......"); + ShowStatusForm(100, "数据加载中......", 0); for (int i = 0; i < 88; i++) { SystemEx.Delay(50); diff --git a/SunnyUI.Net5.Demo/bin/net5.0-windows/SunnyUI.Net5.Demo.dll b/SunnyUI.Net5.Demo/bin/net5.0-windows/SunnyUI.Net5.Demo.dll index d4cac338..632f65f7 100644 Binary files a/SunnyUI.Net5.Demo/bin/net5.0-windows/SunnyUI.Net5.Demo.dll and b/SunnyUI.Net5.Demo/bin/net5.0-windows/SunnyUI.Net5.Demo.dll differ diff --git a/SunnyUI.Net5.Demo/bin/net5.0-windows/SunnyUI.Net5.Demo.exe b/SunnyUI.Net5.Demo/bin/net5.0-windows/SunnyUI.Net5.Demo.exe index 14f07565..c62ea10f 100644 Binary files a/SunnyUI.Net5.Demo/bin/net5.0-windows/SunnyUI.Net5.Demo.exe and b/SunnyUI.Net5.Demo/bin/net5.0-windows/SunnyUI.Net5.Demo.exe differ diff --git a/SunnyUI.Net5.Demo/bin/net5.0-windows/ref/SunnyUI.Net5.Demo.dll b/SunnyUI.Net5.Demo/bin/net5.0-windows/ref/SunnyUI.Net5.Demo.dll index 6513a9f6..77671a20 100644 Binary files a/SunnyUI.Net5.Demo/bin/net5.0-windows/ref/SunnyUI.Net5.Demo.dll and b/SunnyUI.Net5.Demo/bin/net5.0-windows/ref/SunnyUI.Net5.Demo.dll differ diff --git a/SunnyUI/Controls/UIProcessBar.cs b/SunnyUI/Controls/UIProcessBar.cs index e4443ec2..2f908377 100644 --- a/SunnyUI/Controls/UIProcessBar.cs +++ b/SunnyUI/Controls/UIProcessBar.cs @@ -74,7 +74,7 @@ namespace Sunny.UI posValue = Math.Max(value, 0); posValue = Math.Min(posValue, maximum); processWidth = (int)(posValue * Width * 1.0 / Maximum); - processText = (posValue * 100.0 / maximum).ToString("F1") + "%"; + processText = (posValue * 100.0 / maximum).ToString("F" + DecimalCount) + "%"; ValueChanged?.Invoke(this, posValue); Invalidate(); } @@ -157,10 +157,18 @@ namespace Sunny.UI image?.Dispose(); image = null; processWidth = (int)(posValue * Width * 1.0 / Maximum); - Text = (posValue * 100.0 / maximum).ToString("F1") + "%"; + Text = (posValue * 100.0 / maximum).ToString("F" + DecimalCount) + "%"; Invalidate(); } + private int decimalCount = 1; + + public int DecimalCount + { + get => decimalCount; + set => decimalCount = Math.Max(value, 0); + } + public override void SetStyleColor(UIBaseStyle uiColor) { base.SetStyleColor(uiColor); diff --git a/SunnyUI/Forms/UIForm.cs b/SunnyUI/Forms/UIForm.cs index 677f85da..70eeff16 100644 --- a/SunnyUI/Forms/UIForm.cs +++ b/SunnyUI/Forms/UIForm.cs @@ -1478,14 +1478,16 @@ namespace Sunny.UI #endregion 拉拽调整窗体大小 #region 一些辅助窗口 + /// /// 显示进度提示窗 /// /// 描述文字 /// 最大进度值 - public void ShowStatusForm(int maximum = 100, string desc = "系统正在处理中,请稍候...") + /// 显示进度条小数个数 + public void ShowStatusForm(int maximum = 100, string desc = "系统正在处理中,请稍候...", int decimalCount = 1) { - UIStatusFormService.ShowStatusForm(maximum, desc); + UIStatusFormService.ShowStatusForm(maximum, desc, decimalCount); } /// diff --git a/SunnyUI/Forms/UIFormService.cs b/SunnyUI/Forms/UIFormService.cs index 233b0fb5..9e70cfd6 100644 --- a/SunnyUI/Forms/UIFormService.cs +++ b/SunnyUI/Forms/UIFormService.cs @@ -85,10 +85,10 @@ namespace Sunny.UI public class UIStatusFormService { private static bool IsRun; - public static void ShowStatusForm(int maximum = 100, string desc = "系统正在处理中,请稍候...") + public static void ShowStatusForm(int maximum = 100, string desc = "系统正在处理中,请稍候...", int decimalCount = 1) { if (IsRun) return; - Instance.CreateForm(maximum, desc); + Instance.CreateForm(maximum, desc, decimalCount); IsRun = true; } @@ -133,12 +133,12 @@ namespace Sunny.UI private Thread thread; private UIStatusForm form; - private void CreateForm(int max, string desc) + private void CreateForm(int max, string desc, int decimalCount = 1) { CloseForm(); thread = new Thread(delegate () { - form = new UIStatusForm(max, desc); + form = new UIStatusForm(max, desc, decimalCount); form.VisibleChanged += WaitForm_VisibleChanged; Application.Run(form); IsRun = false; diff --git a/SunnyUI/Forms/UIStatusForm.cs b/SunnyUI/Forms/UIStatusForm.cs index 5ef57c05..0621b7bb 100644 --- a/SunnyUI/Forms/UIStatusForm.cs +++ b/SunnyUI/Forms/UIStatusForm.cs @@ -32,13 +32,14 @@ namespace Sunny.UI Description = UILocalize.SystemProcessing; } - public UIStatusForm(int max, string desc) + public UIStatusForm(int max, string desc, int decimalCount = 1) { InitializeComponent(); Maximum = max; Description = desc; Value = 0; + DecimalCount = decimalCount; } [DefaultValue(100)] @@ -98,6 +99,12 @@ namespace Sunny.UI set => labelDescription.Text = value; } + public int DecimalCount + { + get => processBar.DecimalCount; + set => processBar.DecimalCount = value; + } + private delegate void SetTextHandler(string text); public void SetDescription(string text) diff --git a/SunnyUI/Pages/UIPage.cs b/SunnyUI/Pages/UIPage.cs index 73326d12..ffb2f0d4 100644 --- a/SunnyUI/Pages/UIPage.cs +++ b/SunnyUI/Pages/UIPage.cs @@ -298,14 +298,16 @@ namespace Sunny.UI } #region 一些辅助窗口 + /// /// 显示进度提示窗 /// /// 描述文字 /// 最大进度值 - public void ShowStatusForm(int maximum = 100, string desc = "系统正在处理中,请稍候...") + /// 显示进度条小数个数 + public void ShowStatusForm(int maximum = 100, string desc = "系统正在处理中,请稍候...", int decimalCount = 1) { - UIStatusFormService.ShowStatusForm(maximum, desc); + UIStatusFormService.ShowStatusForm(maximum, desc, decimalCount); } ///