From 821928621ae3f2a6971df7adacce086f7966c776 Mon Sep 17 00:00:00 2001 From: zqm Date: Thu, 26 Mar 2026 16:56:26 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E7=94=A8=E7=9B=B8=E5=AF=B9=E5=9D=90?= =?UTF-8?q?=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CS/Framework4.0/Camera/Camera/Setting.cs | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/Windows/CS/Framework4.0/Camera/Camera/Setting.cs b/Windows/CS/Framework4.0/Camera/Camera/Setting.cs index b4015f1..2c9b643 100644 --- a/Windows/CS/Framework4.0/Camera/Camera/Setting.cs +++ b/Windows/CS/Framework4.0/Camera/Camera/Setting.cs @@ -716,8 +716,8 @@ namespace Camera { Rectangle led = _camera.GetLedZone(_currentLedIndex); scaledLedZone = new Rectangle( - (int)(led.X * scaleX), - (int)(led.Y * scaleY), + (int)((detectionZone.X + led.X) * scaleX), + (int)((detectionZone.Y + led.Y) * scaleY), (int)(led.Width * scaleX), (int)(led.Height * scaleY) ); @@ -1002,14 +1002,13 @@ namespace Camera { if (_isDrawingLedMode) { - // 确保是新增LED区,而不是修改现有LED区 int newIndex = _camera.GetLedZoneCount() + 1; - // 确保新索引不与现有索引冲突 while (_camera.GetLedZones().ContainsKey(newIndex)) { newIndex++; } - _camera.AddLedZone(newIndex, new Rectangle(x, y, width, height), Color.Lime); + Rectangle detectionZone = _camera.GetDetectionZone(); + _camera.AddLedZone(newIndex, new Rectangle(detectionZone.X + x, detectionZone.Y + y, width, height), Color.Lime); _selectedZoneIndex = newIndex; _currentLedIndex = newIndex; _isEditingLedZone = true; @@ -1141,8 +1140,9 @@ namespace Camera if (_selectedZoneIndex >= 0 && _camera != null) { Rectangle zone = _camera.GetLedZone(_selectedZoneIndex); - toolStripNumericUpDown1.Value = zone.X; - toolStripNumericUpDown2.Value = zone.Y; + Rectangle detectionZone = _camera.GetDetectionZone(); + toolStripNumericUpDown1.Value = zone.X - detectionZone.X; + toolStripNumericUpDown2.Value = zone.Y - detectionZone.Y; toolStripNumericUpDown3.Value = zone.Width; toolStripNumericUpDown4.Value = zone.Height; } @@ -1350,8 +1350,9 @@ namespace Camera if (_selectedZoneIndex >= 0 && _camera != null) { Rectangle zone = _camera.GetLedZone(_selectedZoneIndex); - toolStripNumericUpDown1.Value = zone.X; - toolStripNumericUpDown2.Value = zone.Y; + Rectangle detectionZone = _camera.GetDetectionZone(); + toolStripNumericUpDown1.Value = zone.X - detectionZone.X; + toolStripNumericUpDown2.Value = zone.Y - detectionZone.Y; toolStripNumericUpDown3.Value = zone.Width; toolStripNumericUpDown4.Value = zone.Height; } @@ -1399,7 +1400,8 @@ namespace Camera int x = (int)toolStripNumericUpDown1.Value; Rectangle zone = _camera.GetLedZone(index); - zone.X = x; + Rectangle detectionZone = _camera.GetDetectionZone(); + zone.X = detectionZone.X + x; _camera.SetLedZone(index, zone); picBoxCamera.Invalidate(); } @@ -1412,7 +1414,8 @@ namespace Camera int y = (int)toolStripNumericUpDown2.Value; Rectangle zone = _camera.GetLedZone(index); - zone.Y = y; + Rectangle detectionZone = _camera.GetDetectionZone(); + zone.Y = detectionZone.Y + y; _camera.SetLedZone(index, zone); picBoxCamera.Invalidate(); }