From 72cf329ce1c456222fcc5276bb65e67cbf6760f0 Mon Sep 17 00:00:00 2001
From: C3204 <zhengyabo@lanpucloud.cn>
Date: 星期四, 22 一月 2026 14:52:39 +0800
Subject: [PATCH] 优化主界面显示为行列矩阵形式,实现鼠标左键双击对应窗体最大化,再次双击恢复之前布局。

---
 LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs |   71 +++++++++++++++++++++++------------
 1 files changed, 47 insertions(+), 24 deletions(-)

diff --git a/LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs b/LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs
index 43158ae..41f0e6b 100644
--- a/LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs
+++ b/LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs
@@ -1,13 +1,33 @@
 锘縰sing HalconDotNet;
+using LB_SmartVision.Forms.Pages.SettingPage;
 using LB_SmartVision.ProcessRun;
 using LB_VisionControl;
-using Layout = LB_SmartVision.Forms.Pages.SettingPage.Layout;
+
 
 namespace LB_SmartVision.Forms.Pages.ProcessPage
 {
     public partial class ProcessControl : UserControl
     {
         UserHSmartWindowControl UserHSmartWindowControl = new UserHSmartWindowControl();
+
+        public string Title = string.Empty;
+
+        public event Control_MouseDown event_MouseDown;
+        public event Control_MouseDoubleClick event_MouseDoubleClick;
+        private void event_mouseDown(object sender, MouseEventArgs e)
+        {
+            if (event_MouseDown != null)
+            {
+                event_MouseDown(sender, e);
+            }
+        }
+        private void event_mouseDoubleClick(object sender, MouseEventArgs e)
+        {
+            if (event_MouseDoubleClick != null)
+            {
+                event_MouseDoubleClick(this, e);
+            }
+        }
 
         ProcessRunBll ProcessRunBll
         {
@@ -37,11 +57,17 @@
         {
             this.panel1.Controls.Add(this.UserHSmartWindowControl);
             this.UserHSmartWindowControl.Dock = DockStyle.Fill;
-
+            this.UserHSmartWindowControl.event_MouseDoubleClick += event_mouseDoubleClick;
+            this.UserHSmartWindowControl.event_MouseDown += event_mouseDown;
             SetTitle(_Layout.ProcessName);
-
+            Title = _Layout.Title;
             if (ProcessRunBll != null)
                 this.label1.Text = $"鎬绘暟锛歿ProcessRunBll.total}";
+            this.isClosed = false;
+            var TaskPhotoContinue = Task.Factory.StartNew(() =>
+            {
+                ThreadCircleRun();
+            });
         }
 
         public void SetTitle(string title)
@@ -101,7 +127,7 @@
                 return false;
             }
 
-            if (isCircleRuning || ProcessRunBll.bPruning)
+            if (isCircleRuning || ProcessRunBll.bRuning)
                 ProcessRunBll.LogInfo($"{ProcessRunBll.Name}姝e湪杩愯", LogInfoType.ERROR);
 
             ProcessRunBll.Run();
@@ -148,37 +174,36 @@
 
                 if (isCircleRuning)
                 {
-                    threadCircleRun = new Thread(ThreadCircleRun);
-                    threadCircleRun.IsBackground = true;
-                    threadCircleRun.Start();
+                    this.mAutoResetEvent.Set();
                 }
                 else
                 {
                     isCircleRuning = false;
-                    threadCircleRun.Abort();
                 }
+                if (!isCircleRuning)
+                {
+                    ProcessRunBll.LogInfo($"{ProcessRunBll.Name}鍏抽棴杩炵画杩愯", LogInfoType.PASS);
+                    return;
+                }
+
+                ProcessRunBll.LogInfo($"{ProcessRunBll.Name}寮�鍚繛缁繍琛�", LogInfoType.WARN);
             }
             catch { }
         }
-
-        Thread threadCircleRun = null;
+        private AutoResetEvent mAutoResetEvent = new AutoResetEvent(false);
+        bool isClosed = false;
 
         void ThreadCircleRun()
         {
-            if (!isCircleRuning)
+            while (!isClosed)
             {
-                ProcessRunBll.LogInfo($"{ProcessRunBll.Name}鍏抽棴杩炵画杩愯", LogInfoType.PASS);
-                return;
-            }
-
-            ProcessRunBll.LogInfo($"{ProcessRunBll.Name}寮�鍚繛缁繍琛�", LogInfoType.WARN);
-
-            while (isCircleRuning)
-            {
-                //this.BeginInvoke(new Action(() =>
-                //{
                 try
                 {
+                    if (isCircleRuning == false)
+                    {
+                        this.mAutoResetEvent.WaitOne();
+                    }
+
                     ProcessRunBll.LogInfo($"{ProcessRunBll.Name}寮�濮嬭繍琛�", LogInfoType.WARN);
                     ClearObj();
                     bool result = ProcessRunBll.Run();
@@ -191,9 +216,7 @@
                         ShowHoImage(RecordImage);
                 }
                 catch { }
-                //}));
-
-                Thread.Sleep(100);
+                Thread.Sleep(33);
             }
         }
 

--
Gitblit v1.9.3