* UILight: 增加文字显示

This commit is contained in:
Sunny 2022-05-15 12:43:03 +08:00
parent 840771c0a4
commit 1c97f500c6

View File

@ -19,6 +19,7 @@
* 2020-01-01: V2.2.0 * 2020-01-01: V2.2.0
* 2021-06-19: V3.0.4 * 2021-06-19: V3.0.4
* 2021-08-07: V3.0.5 线 * 2021-08-07: V3.0.5 线
* 2022-05-15: V3.1.8
******************************************************************************/ ******************************************************************************/
using System; using System;
@ -45,7 +46,7 @@ namespace Sunny.UI
{ {
SetStyleFlags(true, false); SetStyleFlags(true, false);
ShowRect = false; ShowRect = false;
ShowText = false; base.ShowText = false;
Radius = Width = Height = 35; Radius = Width = Height = 35;
} }
@ -70,6 +71,23 @@ namespace Sunny.UI
private int interval = 500; private int interval = 500;
/// <summary>
/// 是否显示文字
/// </summary>
[Description("是否显示文字"), Category("SunnyUI")]
[DefaultValue(false)]
public new bool ShowText
{
get => base.ShowText;
set => base.ShowText = value;
}
protected override void OnPaintFore(Graphics g, GraphicsPath path)
{
SizeF sf = g.MeasureString(Text, Font);
g.DrawString(Text, Font, ForeColor, Width / 2 - sf.Width / 2, Height / 2 - sf.Height / 2);
}
[DefaultValue(500), Description("显示间隔"), Category("SunnyUI")] [DefaultValue(500), Description("显示间隔"), Category("SunnyUI")]
public int Interval public int Interval
{ {