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;