修改显示逻辑

This commit is contained in:
zqm
2025-10-30 15:25:59 +08:00
parent 58ac23b57b
commit a6bb9b8812

View File

@@ -112,32 +112,32 @@ namespace JoyD.Windows.CS.Toprie
g.FillRectangle(brush, 0, 0, BUFFER_WIDTH, BUFFER_HEIGHT);
}
if (isPaused)
{
{
// 暂停状态 - 最高优先级
// 绘制暂停文本
string text = "暂停";
Color textColor = Color.Red;
using (Font font = new Font("Arial", 48, FontStyle.Bold))
using (SolidBrush textBrush = new SolidBrush(textColor))
{
StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Center;
// 将主文本居中显示
g.DrawString(text, font, textBrush,
new RectangleF(0, BUFFER_HEIGHT / 3, BUFFER_WIDTH, BUFFER_HEIGHT / 3),
g.DrawString(text, font, textBrush,
new RectangleF(0, BUFFER_HEIGHT / 3, BUFFER_WIDTH, BUFFER_HEIGHT / 3),
format);
}
}
else if (isPingFailed || isDisconnected || isReconnecting)
{
{
// 非暂停状态下检查Ping状态和连接状态
// 确定显示的文本和颜色
string text = "";
Color textColor = Color.White;
if (isReconnecting)
{
text = "正在重连...";
@@ -153,20 +153,21 @@ namespace JoyD.Windows.CS.Toprie
text = "连接断开";
textColor = Color.Red;
}
// 绘制文本
using (Font font = new Font("Arial", 48, FontStyle.Bold))
using (SolidBrush textBrush = new SolidBrush(textColor))
{
StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Center;
// 将主文本居中显示
g.DrawString(text, font, textBrush,
new RectangleF(0, BUFFER_HEIGHT / 3, BUFFER_WIDTH, BUFFER_HEIGHT / 3),
g.DrawString(text, font, textBrush,
new RectangleF(0, BUFFER_HEIGHT / 3, BUFFER_WIDTH, BUFFER_HEIGHT / 3),
format);
}
}
else g.Clear(Color.Transparent);
}
// 否则清空InfoImage已在开头处理