From ec0073488464057665f9f269c1989f31a01641d1 Mon Sep 17 00:00:00 2001 From: Sunny Date: Tue, 4 Mar 2025 21:18:52 +0800 Subject: [PATCH] =?UTF-8?q?*=20UIBattery:=20=E5=A2=9E=E5=8A=A0=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E6=97=8B=E8=BD=AC=E8=A7=92=E5=BA=A6=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=9B=BE=E6=A0=87=E5=81=8F=E7=A7=BB=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=EF=BC=8C=E8=B0=83=E6=95=B4=E5=9B=BE=E6=A0=87=E6=9C=80=E5=A4=A7?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SunnyUI/Controls/UIBattery.cs | 42 +++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/SunnyUI/Controls/UIBattery.cs b/SunnyUI/Controls/UIBattery.cs index cca95b17..46e2ec3b 100644 --- a/SunnyUI/Controls/UIBattery.cs +++ b/SunnyUI/Controls/UIBattery.cs @@ -20,6 +20,7 @@ * 2021-06-18: V3.0.4 修改可自定义背景色 * 2022-03-19: V3.1.1 重构主题配色 * 2023-11-16: V3.5.2 重构主题 + * 2025-03-04: V3.8.1 增加图标旋转角度,增加图标偏移位置,调整图标最大值 ******************************************************************************/ using System; @@ -85,7 +86,44 @@ namespace Sunny.UI set { symbolSize = Math.Max(value, 16); - symbolSize = Math.Min(value, 128); + symbolSize = Math.Min(value, 256); + Invalidate(); + } + } + + private int _symbolRotate = 0; + + /// + /// 字体图标旋转角度 + /// + [DefaultValue(0)] + [Description("字体图标旋转角度"), Category("SunnyUI")] + public int SymbolRotate + { + get => _symbolRotate; + set + { + if (_symbolRotate != value) + { + _symbolRotate = value; + Invalidate(); + } + } + } + + private Point symbolOffset = new Point(0, 0); + + /// + /// 字体图标的偏移位置 + /// + [DefaultValue(typeof(Point), "0, 0")] + [Description("字体图标的偏移位置"), Category("SunnyUI")] + public Point SymbolOffset + { + get => symbolOffset; + set + { + symbolOffset = value; Invalidate(); } } @@ -219,7 +257,7 @@ namespace Sunny.UI if (multiColor) color = ColorEmpty; } - g.DrawFontImage(ShowSymbol, SymbolSize, color, new Rectangle(0, 0, Width, Height)); + g.DrawFontImage(ShowSymbol, SymbolSize, color, new Rectangle(0, 0, Width, Height), SymbolOffset.X, SymbolOffset.Y, SymbolRotate); } } } \ No newline at end of file