From 4b3a410a5083970bb2e56d2ab459d860c4fa22d0 Mon Sep 17 00:00:00 2001
From: C3204 <zhengyabo@lanpucloud.cn>
Date: 星期二, 30 十二月 2025 15:50:42 +0800
Subject: [PATCH] 添加单流程多相机处理功能。

---
 LB_VisionControl/UserHSmartWindowControl.cs |   31 ++++++++++++++++---------------
 1 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/LB_VisionControl/UserHSmartWindowControl.cs b/LB_VisionControl/UserHSmartWindowControl.cs
index 6aae2eb..473f2a7 100644
--- a/LB_VisionControl/UserHSmartWindowControl.cs
+++ b/LB_VisionControl/UserHSmartWindowControl.cs
@@ -1,4 +1,5 @@
 锘縰sing HalconDotNet;
+using Sunny.UI.Win32;
 using System.Diagnostics;
 
 namespace LB_VisionControl
@@ -32,11 +33,11 @@
         /// </summary>
         public bool bAutoSize = true;
 
-        private HImage _hImage = null;
+        private HObject _hImage = null;
         /// <summary>
         /// 鏄剧ず鍥剧墖(寮傛)
         /// </summary>
-        public HImage hImage
+        public HObject hImage
         {
             get
             {
@@ -273,10 +274,10 @@
         /// <param name="ho_image"></param>
         /// <param name="hWindow"></param>
         /// <param name="autoSize"></param>
-        public async void ShowHoImageAsync(HImage ho_image, HWindow hWindow, bool autoSize = true)
+        public async void ShowHoImageAsync(HObject ho_image, HWindow hWindow, bool autoSize = true)
         {
             if (ho_image == null || !ho_image.IsInitialized())
-                hWindow.ClearWindow();
+                HOperatorSet.ClearWindow(hWindow);
             else
                 await ShowImageAsync(hWindow, ho_image, autoSize);
         }
@@ -286,10 +287,10 @@
         /// </summary>
         /// <param name="ho_image"></param>
         /// <param name="autoSize"></param>
-        public void ShowHoImage(HImage ho_image, bool autoSize = true)
+        public void ShowHoImage(HObject ho_image, bool autoSize = true)
         {
             _hImage = ho_image;
-            hWindowControl.HalconWindow.ClearWindow();
+            HOperatorSet.ClearWindow(hWindowControl.HalconWindow);
 
             if (ho_image == null)
                 return;
@@ -343,7 +344,7 @@
             return;
         }
 
-        private async Task<bool> ShowImageAsync(HWindow hWindow, HImage ho_image, bool autoSize = true)
+        private async Task<bool> ShowImageAsync(HWindow hWindow, HObject ho_image, bool autoSize = true)
         {
             return await Task.Run(() =>
             {
@@ -351,7 +352,7 @@
                 {
                     try
                     {
-                        hWindow.ClearWindow();
+                        HOperatorSet.ClearWindow(hWindow);
                     }
                     catch { return false; }
                     return true;
@@ -359,11 +360,11 @@
 
                 try
                 {
-                    hWindow.ClearWindow();
+                    HOperatorSet.ClearWindow(hWindow);
 
                     if (autoSize)
                     {
-                        ho_image.GetImageSize(out HTuple imgWidth, out HTuple imgHeight);
+                        HOperatorSet.GetImageSize(ho_image, 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 +396,7 @@
                         }
                     }
 
-                    hWindow.DispObj(ho_image);
+                    HOperatorSet.DispObj(ho_image, hWindow);
                 }
                 catch { return false; }
                 return true;
@@ -421,7 +422,7 @@
             try
             {
                 if (ho_object != null && ho_object.IsInitialized())
-                    this.hWindowControl.HalconWindow.DispObj(ho_object);
+                    HOperatorSet.DispObj(ho_object, this.hWindowControl.HalconWindow);
             }
             catch { }
         }
@@ -433,7 +434,7 @@
                 if (ho_object != null && ho_object.IsInitialized())
                 {
                     SetColor(color);
-                    this.hWindowControl.HalconWindow.DispObj(ho_object);
+                    HOperatorSet.DispObj(ho_object, this.hWindowControl.HalconWindow);
                 }
             }
             catch { }
@@ -447,7 +448,7 @@
                 {
                     string color = result ? "green" : "red";
                     SetColor(color);
-                    this.hWindowControl.HalconWindow.DispObj(ho_object);
+                    HOperatorSet.DispObj(ho_object, this.hWindowControl.HalconWindow);
                 }
             }
             catch { }
@@ -488,7 +489,7 @@
 
                 if (this.color != color)
                 {
-                    this.hWindowControl.HalconWindow.SetColor( color);
+                    HOperatorSet.SetColor(this.hWindowControl.HalconWindow, color);
                     this.color = color;
                 }
             }

--
Gitblit v1.9.3