From a0c982ba8abdbd7569a6cae07812127a757fd410 Mon Sep 17 00:00:00 2001
From: C3032 <C3032@BC3032>
Date: 星期三, 07 一月 2026 16:02:34 +0800
Subject: [PATCH] 更新相机实例化和UI线程处理逻辑

---
 LB_SmartVision/Forms/Pages/HistoricalDataPage/HistoricalDataEditPage.cs |   79 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 76 insertions(+), 3 deletions(-)

diff --git a/LB_SmartVision/Forms/Pages/HistoricalDataPage/HistoricalDataEditPage.cs b/LB_SmartVision/Forms/Pages/HistoricalDataPage/HistoricalDataEditPage.cs
index d4c539d..1619fa2 100644
--- a/LB_SmartVision/Forms/Pages/HistoricalDataPage/HistoricalDataEditPage.cs
+++ b/LB_SmartVision/Forms/Pages/HistoricalDataPage/HistoricalDataEditPage.cs
@@ -15,17 +15,26 @@
     {
         public Action<string, LogInfoType> LogInfo;
 
-        private Panel currentContentPanel;
+        private int row2OriginalHeight;
+        private int row3OriginalHeight;
         public HistoricalDataEditPage()
         {
             Name = "HistoricalDataEditPage";
             Text = "鍘嗗彶鏁版嵁鏌ヨ";
 
             InitializeComponent();
+
+            // 淇濆瓨鍘熷琛岄珮搴�
+            row2OriginalHeight = (int)tableLayoutPanel3.RowStyles[1].Height;
+            row3OriginalHeight = (int)tableLayoutPanel3.RowStyles[2].Height;
+
             InitializeDataGridView();
             InitializeComboBox();
         }
 
+        /// <summary>
+        /// 鏁版嵁鏄剧ず琛ㄦ牸鍒濆鍖�
+        /// </summary>
         private void InitializeDataGridView()
         {
             // 璁剧疆DataGridView鍒楀
@@ -48,7 +57,7 @@
             }
 
             // 璁剧疆鍒楁爣棰�
-            dataGridViewHD.Columns[0].Name = "SN鍙�";
+            dataGridViewHD.Columns[0].Name = "SN鍙�"; 
             dataGridViewHD.Columns[1].Name = "鏃堕棿";
             dataGridViewHD.Columns[2].Name = "NG绫�";
             dataGridViewHD.Columns[3].Name = "缂洪櫡澶у皬";
@@ -65,6 +74,9 @@
             dataGridViewHD.RowHeadersVisible = true;
         }
 
+        /// <summary>
+        /// 閫夋嫨渚濇嵁涓嬫媺妗嗗垵濮嬪寲
+        /// </summary>
         private void InitializeComboBox()
         {
             comboBoxSearchBasis.Items.Add("鏃ユ湡");
@@ -74,9 +86,70 @@
             comboBoxSearchBasis.SelectedIndex = 0;
         }
 
-        private void tableLayoutPanel2_Paint(object sender, PaintEventArgs e)
+        /// <summary>
+        /// 涓嬫媺妗嗘帶鍒堕�夐」瑙嗗浘鍙樻崲
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void comboBoxSearchBasis_SelectedIndexChanged(object sender, EventArgs e)
         {
+            ComboBox cb = sender as ComboBox;
 
+            if (cb.SelectedIndex == 0)
+            {
+                ShowRow2();
+            }
+            else if (cb.SelectedIndex == 1)
+            {
+                ShowRow3();
+            }
+        }
+
+        private void ShowRow2()
+        {
+            // 鏄剧ずRow2锛堟仮澶嶉珮搴︼級
+            tableLayoutPanel3.RowStyles[1].SizeType = SizeType.Absolute;
+            tableLayoutPanel3.RowStyles[1].Height = row2OriginalHeight;
+
+            // 闅愯棌Row3锛堥珮搴﹁涓�0锛�
+            tableLayoutPanel3.RowStyles[2].SizeType = SizeType.Absolute;
+            tableLayoutPanel3.RowStyles[2].Height = 0;
+
+            // 鏄剧ずRow2涓殑鎺т欢
+            foreach (Control ctrl in tableLayoutPanel3.Controls)
+            {
+                int row = tableLayoutPanel3.GetRow(ctrl);
+                if (row == 1)
+                    ctrl.Visible = true;
+                else if (row == 2)
+                    ctrl.Visible = false;
+            }
+        }
+
+        private void ShowRow3()
+        {
+            // 闅愯棌Row2锛堥珮搴﹁涓�0锛�
+            tableLayoutPanel3.RowStyles[1].SizeType = SizeType.Absolute;
+            tableLayoutPanel3.RowStyles[1].Height = 0;
+
+            // 鏄剧ずRow3锛堟仮澶嶉珮搴︼級
+            tableLayoutPanel3.RowStyles[2].SizeType = SizeType.Absolute;
+            tableLayoutPanel3.RowStyles[2].Height = row3OriginalHeight;
+
+            // 鏄剧ずRow3涓殑鎺т欢
+            foreach (Control ctrl in tableLayoutPanel3.Controls)
+            {
+                int row = tableLayoutPanel3.GetRow(ctrl);
+                if (row == 1)
+                    ctrl.Visible = false;
+                else if (row == 2)
+                    ctrl.Visible = true;
+            }
+        }
+
+        private void dateTimePickerStart_ValueChanged(object sender, EventArgs e)
+        {
+            dateTimePickerEnd.MinDate = dateTimePickerStart.Value;
         }
     }
 }

--
Gitblit v1.9.3