From fec341de45f4b3fd1825807f0b3261143fa13caa Mon Sep 17 00:00:00 2001
From: C3204 <zhengyabo@lanpucloud.cn>
Date: 星期一, 29 十二月 2025 17:03:45 +0800
Subject: [PATCH] 修复部分显示工具为面向对象。
---
LB_VisionControl/UserHSmartWindowControl.cs | 30 +++++++++++++++---------------
1 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/LB_VisionControl/UserHSmartWindowControl.cs b/LB_VisionControl/UserHSmartWindowControl.cs
index a1c3acb..6aae2eb 100644
--- a/LB_VisionControl/UserHSmartWindowControl.cs
+++ b/LB_VisionControl/UserHSmartWindowControl.cs
@@ -32,11 +32,11 @@
/// </summary>
public bool bAutoSize = true;
- private HObject _hImage = null;
+ private HImage _hImage = null;
/// <summary>
/// 鏄剧ず鍥剧墖(寮傛)
/// </summary>
- public HObject hImage
+ public HImage hImage
{
get
{
@@ -273,10 +273,10 @@
/// <param name="ho_image"></param>
/// <param name="hWindow"></param>
/// <param name="autoSize"></param>
- public async void ShowHoImageAsync(HObject ho_image, HWindow hWindow, bool autoSize = true)
+ public async void ShowHoImageAsync(HImage ho_image, HWindow hWindow, bool autoSize = true)
{
if (ho_image == null || !ho_image.IsInitialized())
- HOperatorSet.ClearWindow(hWindow);
+ hWindow.ClearWindow();
else
await ShowImageAsync(hWindow, ho_image, autoSize);
}
@@ -286,10 +286,10 @@
/// </summary>
/// <param name="ho_image"></param>
/// <param name="autoSize"></param>
- public void ShowHoImage(HObject ho_image, bool autoSize = true)
+ public void ShowHoImage(HImage ho_image, bool autoSize = true)
{
_hImage = ho_image;
- HOperatorSet.ClearWindow(hWindowControl.HalconWindow);
+ hWindowControl.HalconWindow.ClearWindow();
if (ho_image == null)
return;
@@ -343,7 +343,7 @@
return;
}
- private async Task<bool> ShowImageAsync(HWindow hWindow, HObject ho_image, bool autoSize = true)
+ private async Task<bool> ShowImageAsync(HWindow hWindow, HImage ho_image, bool autoSize = true)
{
return await Task.Run(() =>
{
@@ -351,7 +351,7 @@
{
try
{
- HOperatorSet.ClearWindow(hWindow);
+ hWindow.ClearWindow();
}
catch { return false; }
return true;
@@ -359,11 +359,11 @@
try
{
- HOperatorSet.ClearWindow(hWindow);
+ hWindow.ClearWindow();
if (autoSize)
{
- HOperatorSet.GetImageSize(ho_image, out HTuple imgWidth, out HTuple imgHeight);
+ ho_image.GetImageSize(out HTuple imgWidth, out HTuple imgHeight);
if (imgWidth.Length > 0)
{
hWindow.GetWindowExtents(out int winRow, out int winCol, out int winWidth, out int winHeight);
@@ -395,7 +395,7 @@
}
}
- HOperatorSet.DispObj(ho_image, hWindow);
+ hWindow.DispObj(ho_image);
}
catch { return false; }
return true;
@@ -421,7 +421,7 @@
try
{
if (ho_object != null && ho_object.IsInitialized())
- HOperatorSet.DispObj(ho_object, this.hWindowControl.HalconWindow);
+ this.hWindowControl.HalconWindow.DispObj(ho_object);
}
catch { }
}
@@ -433,7 +433,7 @@
if (ho_object != null && ho_object.IsInitialized())
{
SetColor(color);
- HOperatorSet.DispObj(ho_object, this.hWindowControl.HalconWindow);
+ this.hWindowControl.HalconWindow.DispObj(ho_object);
}
}
catch { }
@@ -447,7 +447,7 @@
{
string color = result ? "green" : "red";
SetColor(color);
- HOperatorSet.DispObj(ho_object, this.hWindowControl.HalconWindow);
+ this.hWindowControl.HalconWindow.DispObj(ho_object);
}
}
catch { }
@@ -488,7 +488,7 @@
if (this.color != color)
{
- HOperatorSet.SetColor(this.hWindowControl.HalconWindow, color);
+ this.hWindowControl.HalconWindow.SetColor( color);
this.color = color;
}
}
--
Gitblit v1.9.3