* UIScrollingText: 停止滚动时,可以设置默认显示位置

This commit is contained in:
Sunny 2024-12-02 21:25:39 +08:00
parent 120dbf2151
commit 452e9e6e15

View File

@ -21,6 +21,7 @@
* 2022-03-19: V3.1.1 * 2022-03-19: V3.1.1
* 2023-02-23: V3.3.2 * 2023-02-23: V3.3.2
* 2023-05-12: V3.3.6 DrawString函数 * 2023-05-12: V3.3.6 DrawString函数
* 2024-12-02: V3.8.0
******************************************************************************/ ******************************************************************************/
using System; using System;
@ -152,6 +153,8 @@ namespace Sunny.UI
/// <param name="g">绘图图面</param> /// <param name="g">绘图图面</param>
/// <param name="path">绘图路径</param> /// <param name="path">绘图路径</param>
protected override void OnPaintFore(Graphics g, GraphicsPath path) protected override void OnPaintFore(Graphics g, GraphicsPath path)
{
if (Active)
{ {
Size sf = TextRenderer.MeasureText(Text, Font); Size sf = TextRenderer.MeasureText(Text, Font);
if (TextWidth != sf.Width) if (TextWidth != sf.Width)
@ -190,6 +193,11 @@ namespace Sunny.UI
g.DrawString(Text, Font, ForeColor, new Rectangle(XPos, 0, Width, Height), ContentAlignment.MiddleLeft); g.DrawString(Text, Font, ForeColor, new Rectangle(XPos, 0, Width, Height), ContentAlignment.MiddleLeft);
} }
} }
else
{
base.OnPaintFore(g, path);
}
}
/// <summary> /// <summary>
/// 重载控件尺寸变更 /// 重载控件尺寸变更