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