From 8d0f19927da7b837979f1ce95a6cfd208c780ba0 Mon Sep 17 00:00:00 2001 From: zqm Date: Thu, 26 Mar 2026 16:45:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Camera/Camera/Setting.Designer.cs | 40 +++------------ .../CS/Framework4.0/Camera/Camera/Setting.cs | 49 ++++++------------- 2 files changed, 22 insertions(+), 67 deletions(-) diff --git a/Windows/CS/Framework4.0/Camera/Camera/Setting.Designer.cs b/Windows/CS/Framework4.0/Camera/Camera/Setting.Designer.cs index 7d59b1f..b61989c 100644 --- a/Windows/CS/Framework4.0/Camera/Camera/Setting.Designer.cs +++ b/Windows/CS/Framework4.0/Camera/Camera/Setting.Designer.cs @@ -19,7 +19,6 @@ namespace Camera { this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.picBoxCamera = new System.Windows.Forms.PictureBox(); - this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer(); this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); @@ -42,10 +41,6 @@ namespace Camera this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.picBoxCamera)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); - this.splitContainer2.Panel1.SuspendLayout(); - this.splitContainer2.Panel2.SuspendLayout(); - this.splitContainer2.SuspendLayout(); this.toolStrip1.SuspendLayout(); this.toolStrip2.SuspendLayout(); this.toolStripContainer1.SuspendLayout(); @@ -65,7 +60,7 @@ namespace Camera // // splitContainer1.Panel2 // - this.splitContainer1.Panel2.Controls.Add(this.splitContainer2); + this.splitContainer1.Panel2.Controls.Add(this.toolStripContainer1); this.splitContainer1.Panel2MinSize = 457; this.splitContainer1.Size = new System.Drawing.Size(1263, 515); this.splitContainer1.SplitterDistance = 700; @@ -86,24 +81,12 @@ namespace Camera this.picBoxCamera.MouseMove += new System.Windows.Forms.MouseEventHandler(this.PicBoxCamera_MouseMove); this.picBoxCamera.MouseUp += new System.Windows.Forms.MouseEventHandler(this.PicBoxCamera_MouseUp); // - // splitContainer2 - // - this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer2.Location = new System.Drawing.Point(0, 0); - this.splitContainer2.Name = "splitContainer2"; - this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal; - // - // splitContainer2.Panel1 - // - this.splitContainer2.Panel1.Controls.Add(this.toolStripContainer1); - this.splitContainer2.Panel1MinSize = 120; - // // toolStripContainer1 // this.toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill; this.toolStripContainer1.Location = new System.Drawing.Point(0, 0); this.toolStripContainer1.Name = "toolStripContainer1"; - this.toolStripContainer1.Size = new System.Drawing.Size(559, 120); + this.toolStripContainer1.Size = new System.Drawing.Size(559, 515); this.toolStripContainer1.TabIndex = 0; this.toolStripContainer1.Text = "toolStripContainer1"; this.toolStripContainer1.TopToolStripPanel.Dock = System.Windows.Forms.DockStyle.Top; @@ -111,13 +94,10 @@ namespace Camera this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.toolStrip1); this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.toolStrip2); // - // splitContainer2.Panel2 + // toolStripContainer1.ContentPanel // - this.splitContainer2.Panel2.Controls.Add(this.dataGridView1); - this.splitContainer2.Panel2MinSize = 100; - this.splitContainer2.Size = new System.Drawing.Size(559, 515); - this.splitContainer2.SplitterDistance = 257; - this.splitContainer2.TabIndex = 0; + this.toolStripContainer1.ContentPanel.Controls.Add(this.dataGridView1); + this.toolStripContainer1.ContentPanel.Dock = System.Windows.Forms.DockStyle.Fill; // // toolStrip1 // @@ -132,7 +112,7 @@ namespace Camera this.toolStripTextBox1}); this.toolStrip1.Location = new System.Drawing.Point(0, 0); this.toolStrip1.Name = "toolStrip1"; - this.toolStrip1.Size = new System.Drawing.Size(200, 25); + this.toolStrip1.Size = new System.Drawing.Size(559, 25); this.toolStrip1.TabIndex = 0; this.toolStrip1.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.toolStrip1_ItemClicked); // @@ -198,7 +178,7 @@ namespace Camera this.toolStripLabel4, this.toolStripNumericUpDown4}); this.toolStrip2.Name = "toolStrip2"; - this.toolStrip2.Size = new System.Drawing.Size(353, 30); + this.toolStrip2.Size = new System.Drawing.Size(559, 30); this.toolStrip2.TabIndex = 1; // // toolStripLabel1 @@ -375,11 +355,6 @@ namespace Camera ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.picBoxCamera)).EndInit(); - this.splitContainer2.Panel1.ResumeLayout(false); - this.splitContainer2.Panel1.PerformLayout(); - this.splitContainer2.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); - this.splitContainer2.ResumeLayout(false); this.toolStrip1.ResumeLayout(false); this.toolStrip1.PerformLayout(); this.toolStrip2.ResumeLayout(false); @@ -394,7 +369,6 @@ namespace Camera #endregion private System.Windows.Forms.SplitContainer splitContainer1; - private System.Windows.Forms.SplitContainer splitContainer2; private System.Windows.Forms.PictureBox picBoxCamera; private System.Windows.Forms.ToolStripContainer toolStripContainer1; private System.Windows.Forms.ToolStrip toolStrip1; diff --git a/Windows/CS/Framework4.0/Camera/Camera/Setting.cs b/Windows/CS/Framework4.0/Camera/Camera/Setting.cs index dc81136..b4015f1 100644 --- a/Windows/CS/Framework4.0/Camera/Camera/Setting.cs +++ b/Windows/CS/Framework4.0/Camera/Camera/Setting.cs @@ -207,7 +207,6 @@ namespace Camera splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; splitContainer1.Panel2MinSize = 380; splitContainer1.SplitterDistance = splitContainer1.Width - 380; - splitContainer2.Panel1MinSize = 40; UpdateDataGridView(); UpdateLedZoneButtonsVisibility(0); } @@ -344,6 +343,7 @@ namespace Camera if (_camera != null) { + Rectangle detectionZone = _camera.GetDetectionZone(); var allLedZones = _camera.GetLedZones(); foreach (var kvp in allLedZones) { @@ -353,7 +353,9 @@ namespace Camera if (ledZone.Width > 0 && ledZone.Height > 0) { - dataGridView1.Rows.Add(index, ledZone.X, ledZone.Y, ledZone.Width, ledZone.Height, ColorTranslator.ToHtml(ledColor)); + int relativeX = ledZone.X - detectionZone.X; + int relativeY = ledZone.Y - detectionZone.Y; + dataGridView1.Rows.Add(index, relativeX, relativeY, ledZone.Width, ledZone.Height, ColorTranslator.ToHtml(ledColor)); } } } @@ -427,8 +429,8 @@ namespace Camera { Rectangle ledZone = _camera.GetLedZone(_currentLedIndex); currentEditZone = new Rectangle( - (int)(ledZone.X * scaleX), - (int)(ledZone.Y * scaleY), + (int)((detectionZone.X + ledZone.X) * scaleX), + (int)((detectionZone.Y + ledZone.Y) * scaleY), (int)(ledZone.Width * scaleX), (int)(ledZone.Height * scaleY) ); @@ -452,8 +454,8 @@ namespace Camera Color ledColor = _camera.GetLedZoneColor(index); Rectangle scaledLed = new Rectangle( - (int)(ledZone.X * scaleX), - (int)(ledZone.Y * scaleY), + (int)((detectionZone.X + ledZone.X) * scaleX), + (int)((detectionZone.Y + ledZone.Y) * scaleY), (int)(ledZone.Width * scaleX), (int)(ledZone.Height * scaleY) ); @@ -505,8 +507,8 @@ namespace Camera Color ledColor = _camera.GetLedZoneColor(index); Rectangle scaledLed = new Rectangle( - (int)(ledZone.X * scaleX), - (int)(ledZone.Y * scaleY), + (int)((detectionZone.X + ledZone.X) * scaleX), + (int)((detectionZone.Y + ledZone.Y) * scaleY), (int)(ledZone.Width * scaleX), (int)(ledZone.Height * scaleY) ); @@ -559,8 +561,8 @@ namespace Camera Color ledColor = _camera.GetLedZoneColor(index); Rectangle scaledLed = new Rectangle( - (int)(ledZone.X * scaleX), - (int)(ledZone.Y * scaleY), + (int)((detectionZone.X + ledZone.X) * scaleX), + (int)((detectionZone.Y + ledZone.Y) * scaleY), (int)(ledZone.Width * scaleX), (int)(ledZone.Height * scaleY) ); @@ -1343,14 +1345,7 @@ namespace Camera toolStripTextBox1.Visible = false; toolStripTextBox1.Text = ""; // 显示位置和宽高设置框 - toolStripLabel1.Visible = true; - toolStripNumericUpDown1.Visible = true; - toolStripLabel2.Visible = true; - toolStripNumericUpDown2.Visible = true; - toolStripLabel3.Visible = true; - toolStripNumericUpDown3.Visible = true; - toolStripLabel4.Visible = true; - toolStripNumericUpDown4.Visible = true; + toolStrip2.Visible = true; // 更新位置和宽高值 if (_selectedZoneIndex >= 0 && _camera != null) { @@ -1368,14 +1363,7 @@ namespace Camera toolStripTextBox1.Visible = true; toolStripTextBox1.Text = _currentLedIndex.ToString(); // 不显示位置和宽高设置框 - toolStripLabel1.Visible = false; - toolStripNumericUpDown1.Visible = false; - toolStripLabel2.Visible = false; - toolStripNumericUpDown2.Visible = false; - toolStripLabel3.Visible = false; - toolStripNumericUpDown3.Visible = false; - toolStripLabel4.Visible = false; - toolStripNumericUpDown4.Visible = false; + toolStrip2.Visible = false; break; case 2: // 绘制状态 toolStripButton2.Visible = true; @@ -1383,14 +1371,7 @@ namespace Camera toolStripButton4.Visible = false; toolStripTextBox1.Visible = false; toolStripTextBox1.Text = ""; - toolStripLabel1.Visible = false; - toolStripNumericUpDown1.Visible = false; - toolStripLabel2.Visible = false; - toolStripNumericUpDown2.Visible = false; - toolStripLabel3.Visible = false; - toolStripNumericUpDown3.Visible = false; - toolStripLabel4.Visible = false; - toolStripNumericUpDown4.Visible = false; + toolStrip2.Visible = false; break; } }