From ad6c439a22531fabff3a7295d732d76f71734851 Mon Sep 17 00:00:00 2001 From: zqm Date: Thu, 26 Mar 2026 10:30:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E6=B7=BB=E5=8A=A0led?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Windows/CS/Framework4.0/Camera/Camera/Setting.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Windows/CS/Framework4.0/Camera/Camera/Setting.cs b/Windows/CS/Framework4.0/Camera/Camera/Setting.cs index 7402e99..26c04e4 100644 --- a/Windows/CS/Framework4.0/Camera/Camera/Setting.cs +++ b/Windows/CS/Framework4.0/Camera/Camera/Setting.cs @@ -874,18 +874,24 @@ namespace Camera float scaleY = (float)picBoxCamera.ClientSize.Height / imageHeight; Point imagePoint = new Point((int)(e.Location.X / scaleX), (int)(e.Location.Y / scaleY)); - if (_isDrawing && !_isMoving) + if (_isDrawing) { int x = Math.Min(_startPoint.X, imagePoint.X); int y = Math.Min(_startPoint.Y, imagePoint.Y); int width = Math.Abs(imagePoint.X - _startPoint.X); int height = Math.Abs(imagePoint.Y - _startPoint.Y); - if (width > 10 && height > 10) + if (width > 5 && height > 5) { 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); _selectedZoneIndex = newIndex; _currentLedIndex = newIndex;