移动检测区

This commit is contained in:
zqm
2026-03-25 13:47:26 +08:00
parent 7c6de3159e
commit 481abe11b8

View File

@@ -431,6 +431,7 @@ namespace Camera
{ {
_isMoving = true; _isMoving = true;
_startPoint = imagePoint; _startPoint = imagePoint;
_resizeStartPoint = controlPoint;
_originalZone = _isEditingDetectionZone ? detectionZone : ledZone; _originalZone = _isEditingDetectionZone ? detectionZone : ledZone;
} }
} }
@@ -441,6 +442,7 @@ namespace Camera
_selectedZoneIndex = 0; _selectedZoneIndex = 0;
_isMoving = true; _isMoving = true;
_startPoint = imagePoint; _startPoint = imagePoint;
_resizeStartPoint = controlPoint;
_originalZone = detectionZone; _originalZone = detectionZone;
} }
else if (ledZone.Contains(imagePoint)) else if (ledZone.Contains(imagePoint))
@@ -448,6 +450,7 @@ namespace Camera
_selectedZoneIndex = 1; _selectedZoneIndex = 1;
_isMoving = true; _isMoving = true;
_startPoint = imagePoint; _startPoint = imagePoint;
_resizeStartPoint = controlPoint;
_originalZone = ledZone; _originalZone = ledZone;
} }
else else
@@ -584,14 +587,12 @@ namespace Camera
{ {
picBoxCamera.Cursor = Cursors.SizeAll; picBoxCamera.Cursor = Cursors.SizeAll;
Point imagePoint = new Point((int)(e.Location.X / scaleX), (int)(e.Location.Y / scaleY)); int dx = e.Location.X - _resizeStartPoint.X;
int dy = e.Location.Y - _resizeStartPoint.Y;
int dx = imagePoint.X - _startPoint.X;
int dy = imagePoint.Y - _startPoint.Y;
Rectangle newZone = new Rectangle( Rectangle newZone = new Rectangle(
_originalZone.X + dx, _originalZone.X + (int)(dx / scaleX),
_originalZone.Y + dy, _originalZone.Y + (int)(dy / scaleY),
_originalZone.Width, _originalZone.Width,
_originalZone.Height _originalZone.Height
); );
@@ -611,7 +612,7 @@ namespace Camera
} }
UpdateDataGridView(); UpdateDataGridView();
picBoxCamera.Invalidate(); picBoxCamera.Update();
} }
} }