* UIRoundProcess: 增加起始角度和扫描角度

This commit is contained in:
Sunny 2023-07-15 11:31:26 +08:00
parent 8a2053ee7f
commit d4eefa4c09
2 changed files with 33 additions and 3 deletions

View File

@ -20,6 +20,7 @@
* 2021-10-18: V3.0.8 * 2021-10-18: V3.0.8
* 2022-03-19: V3.1.1 * 2022-03-19: V3.1.1
* 2023-07-12: V3.4.0 * 2023-07-12: V3.4.0
* 2023-07-15: V3.4.0
******************************************************************************/ ******************************************************************************/
using System; using System;
@ -53,6 +54,35 @@ namespace Sunny.UI
ShowRect = false; ShowRect = false;
} }
private int startAngle = 0;
[Description("起始角度正北为0顺时针0到360°"), Category("SunnyUI")]
[DefaultValue(0)]
public int StartAngle
{
get => startAngle;
set
{
startAngle = value;
Invalidate();
}
}
private int sweepAngle = 360;
[Description("扫描角度范围0到360°"), Category("SunnyUI")]
[DefaultValue(360)]
public int SweepAngle
{
get => sweepAngle;
set
{
sweepAngle = Math.Max(1, value);
sweepAngle = Math.Min(360, value);
Invalidate();
}
}
[Description("显示文字小数位数"), Category("SunnyUI")] [Description("显示文字小数位数"), Category("SunnyUI")]
[DefaultValue(1)] [DefaultValue(1)]
public int DecimalPlaces public int DecimalPlaces
@ -211,8 +241,8 @@ namespace Sunny.UI
inner = iin; inner = iin;
outer = iou; outer = iou;
g.FillFan(ProcessBackColor, ClientRectangle.Center(), Inner, Outer, 0, 360); g.FillFan(ProcessBackColor, ClientRectangle.Center(), Inner, Outer, StartAngle - 90, SweepAngle);
g.FillFan(ProcessColor, ClientRectangle.Center(), Inner, Outer, -90, Value * 1.0f / Maximum * 360.0f); g.FillFan(ProcessColor, ClientRectangle.Center(), Inner, Outer, StartAngle - 90, Value * 1.0f / Maximum * SweepAngle);
} }
/// <summary> /// <summary>

View File

@ -108,7 +108,7 @@ namespace Sunny.UI
} }
internal static float DefaultFontSize = 12; internal static float DefaultFontSize = 12;
internal static float DefaultSubFontSize = 9; public static float DefaultSubFontSize = 9;
/// <summary> /// <summary>
/// 默认字体 /// 默认字体
/// </summary> /// </summary>