修复IDE0017警告:简化StringFormat对象初始化
This commit is contained in:
@@ -708,7 +708,12 @@ namespace JoyD.Windows.CS.Toprie
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 调用温度显示更新方法
|
// 调用温度显示更新方法
|
||||||
|
// 在就绪条件下,调用更新实时信息
|
||||||
|
bool isReady = !_isPaused && IsDevicePingable && _deviceManager != null && _deviceManager.ConnectionStatus == ConnectionStatus.Connected;
|
||||||
|
if (isReady)
|
||||||
|
{
|
||||||
UpdateRealTimeInfoOnUI();
|
UpdateRealTimeInfoOnUI();
|
||||||
|
}
|
||||||
|
|
||||||
Image lastImage = null;
|
Image lastImage = null;
|
||||||
Image infoImage = null;
|
Image infoImage = null;
|
||||||
@@ -786,7 +791,9 @@ namespace JoyD.Windows.CS.Toprie
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 步骤2.1:绘制DisplayImage(实时温度信息等)
|
// 步骤2.1:绘制DisplayImage(实时温度信息等) - 仅在就绪条件下执行
|
||||||
|
if (isReady)
|
||||||
|
{
|
||||||
lock (_displayImageLock)
|
lock (_displayImageLock)
|
||||||
{
|
{
|
||||||
if (_displayImage != null)
|
if (_displayImage != null)
|
||||||
@@ -794,6 +801,7 @@ namespace JoyD.Windows.CS.Toprie
|
|||||||
g.DrawImage(_displayImage, 0, 0);
|
g.DrawImage(_displayImage, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 注意:温度信息不再直接在这里绘制
|
// 注意:温度信息不再直接在这里绘制
|
||||||
// 而是在UpdateRealTimeInfoOnUI方法中绘制到_displayImage,然后在这里绘制到_imageBuffer
|
// 而是在UpdateRealTimeInfoOnUI方法中绘制到_displayImage,然后在这里绘制到_imageBuffer
|
||||||
@@ -1948,9 +1956,11 @@ namespace JoyD.Windows.CS.Toprie
|
|||||||
// 设置文本样式
|
// 设置文本样式
|
||||||
Font font = new Font("微软雅黑", 12, FontStyle.Bold);
|
Font font = new Font("微软雅黑", 12, FontStyle.Bold);
|
||||||
Brush brush = new SolidBrush(Color.White);
|
Brush brush = new SolidBrush(Color.White);
|
||||||
StringFormat format = new StringFormat();
|
StringFormat format = new StringFormat
|
||||||
format.Alignment = StringAlignment.Near; // 左对齐
|
{
|
||||||
format.LineAlignment = StringAlignment.Center;
|
Alignment = StringAlignment.Near, // 左对齐
|
||||||
|
LineAlignment = StringAlignment.Center
|
||||||
|
};
|
||||||
|
|
||||||
// 计算文本区域大小
|
// 计算文本区域大小
|
||||||
SizeF[] textSizes = new SizeF[temperatureTexts.Count];
|
SizeF[] textSizes = new SizeF[temperatureTexts.Count];
|
||||||
|
|||||||
Reference in New Issue
Block a user