实现外部图像只放在mRealTimeImage中,由定时器负责UI更新的功能

This commit is contained in:
zqm
2025-11-06 11:00:49 +08:00
parent ca98f7e257
commit 05bd08647c

View File

@@ -107,8 +107,6 @@ namespace JoyD.Windows.CS
{ {
get get
{ {
if (DesignMode || this.IsDisposed || this.Disposing || pictureBoxTemperatureDisplay == null || pictureBoxTemperatureDisplay.IsDisposed)
return null;
return mRealTimeImage; return mRealTimeImage;
} }
set set
@@ -133,7 +131,7 @@ namespace JoyD.Windows.CS
return; return;
// 检查是否在有效状态下操作 // 检查是否在有效状态下操作
if (this.IsDisposed || this.Disposing || pictureBoxTemperatureDisplay == null || pictureBoxTemperatureDisplay.IsDisposed) if (this.IsDisposed || this.Disposing)
{ {
// 如果窗口已关闭或正在关闭,释放传入的图像 // 如果窗口已关闭或正在关闭,释放传入的图像
value?.Dispose(); value?.Dispose();
@@ -146,11 +144,9 @@ namespace JoyD.Windows.CS
try { mRealTimeImage.Dispose(); } catch { } try { mRealTimeImage.Dispose(); } catch { }
} }
// 设置新图像 // 设置mRealTimeImage不直接更新UI
// UI更新将由定时器的Timer_Tick事件处理
mRealTimeImage = value; mRealTimeImage = value;
// 立即更新UI
UpdatePictureBoxImage();
} }
} }
} }