* UIBattery: 增加图标旋转角度,增加图标偏移位置,调整图标最大值

This commit is contained in:
Sunny 2025-03-04 21:18:52 +08:00
parent 282c1ae17c
commit ec00734884

View File

@ -20,6 +20,7 @@
* 2021-06-18: V3.0.4 * 2021-06-18: V3.0.4
* 2022-03-19: V3.1.1 * 2022-03-19: V3.1.1
* 2023-11-16: V3.5.2 * 2023-11-16: V3.5.2
* 2025-03-04: V3.8.1
******************************************************************************/ ******************************************************************************/
using System; using System;
@ -85,7 +86,44 @@ namespace Sunny.UI
set set
{ {
symbolSize = Math.Max(value, 16); symbolSize = Math.Max(value, 16);
symbolSize = Math.Min(value, 128); symbolSize = Math.Min(value, 256);
Invalidate();
}
}
private int _symbolRotate = 0;
/// <summary>
/// 字体图标旋转角度
/// </summary>
[DefaultValue(0)]
[Description("字体图标旋转角度"), Category("SunnyUI")]
public int SymbolRotate
{
get => _symbolRotate;
set
{
if (_symbolRotate != value)
{
_symbolRotate = value;
Invalidate();
}
}
}
private Point symbolOffset = new Point(0, 0);
/// <summary>
/// 字体图标的偏移位置
/// </summary>
[DefaultValue(typeof(Point), "0, 0")]
[Description("字体图标的偏移位置"), Category("SunnyUI")]
public Point SymbolOffset
{
get => symbolOffset;
set
{
symbolOffset = value;
Invalidate(); Invalidate();
} }
} }
@ -219,7 +257,7 @@ namespace Sunny.UI
if (multiColor) color = ColorEmpty; 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);
} }
} }
} }