From 1c0d65d8161567b4ab39a2dbb024447946bf8846 Mon Sep 17 00:00:00 2001 From: Sunny Date: Thu, 9 May 2024 14:21:38 +0800 Subject: [PATCH] =?UTF-8?q?*=20UIProcessBar:=20=E8=B0=83=E6=95=B4=E6=9C=80?= =?UTF-8?q?=E5=B0=8F=E5=AE=BD=E5=BA=A6=EF=BC=8C=E4=BB=A5=E9=80=82=E5=BA=94?= =?UTF-8?q?=E5=9E=82=E7=9B=B4=E6=96=B9=E5=90=91=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SunnyUI/Controls/UIProcessBar.cs | 11 ++++++++--- SunnyUI/SunnyUI.csproj | 7 ------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/SunnyUI/Controls/UIProcessBar.cs b/SunnyUI/Controls/UIProcessBar.cs index 4353d9c3..92e1fc08 100644 --- a/SunnyUI/Controls/UIProcessBar.cs +++ b/SunnyUI/Controls/UIProcessBar.cs @@ -25,6 +25,7 @@ * 2022-09-05: V3.2.3 修改最大值至少为1 * 2023-05-12: V3.3.6 重构DrawString函数 * 2023-09-05: V3.4.2 修复值计算过程中的Int越界问题 + * 2024-05-09: V3.6.6 调整最小宽度,以适应垂直方向显示 ******************************************************************************/ using System; @@ -48,7 +49,7 @@ namespace Sunny.UI public UIProcessBar() { SetStyleFlags(true, false); - MinimumSize = new Size(70, 3); + MinimumSize = new Size(3, 3); Size = new Size(300, 29); ShowText = false; @@ -151,8 +152,12 @@ namespace Sunny.UI else processText = posValue.ToString(); - Size sf = TextRenderer.MeasureText(processText, Font); - bool canShow = Height > sf.Height + 4; + Size sf = TextRenderer.MeasureText("100%", Font); + bool canShow; + if (Direction == UILine.LineDirection.Horizontal) + canShow = Height > sf.Height + 4; + else + canShow = Width > sf.Width + 4; if (ShowValue && canShow) { diff --git a/SunnyUI/SunnyUI.csproj b/SunnyUI/SunnyUI.csproj index 96cd215b..78be8c85 100644 --- a/SunnyUI/SunnyUI.csproj +++ b/SunnyUI/SunnyUI.csproj @@ -37,13 +37,6 @@ - - - - - - - True