From 7c6de3159e9e8c5b2761ce123b4ab3138caa3d00 Mon Sep 17 00:00:00 2001 From: zqm Date: Wed, 25 Mar 2026 13:36:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E5=8F=A5=E6=9F=84=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CS/Framework4.0/Camera/Camera/Setting.cs | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/Windows/CS/Framework4.0/Camera/Camera/Setting.cs b/Windows/CS/Framework4.0/Camera/Camera/Setting.cs index 602dc22..8c6ad5a 100644 --- a/Windows/CS/Framework4.0/Camera/Camera/Setting.cs +++ b/Windows/CS/Framework4.0/Camera/Camera/Setting.cs @@ -394,9 +394,9 @@ namespace Camera return; } - float scaleX = (float)imageWidth / picBoxCamera.ClientSize.Width; - float scaleY = (float)imageHeight / picBoxCamera.ClientSize.Height; - Point imagePoint = new Point((int)(e.X * scaleX), (int)(e.Y * scaleY)); + float scaleX = (float)picBoxCamera.ClientSize.Width / imageWidth; + float scaleY = (float)picBoxCamera.ClientSize.Height / imageHeight; + Point imagePoint = new Point((int)(e.Location.X / scaleX), (int)(e.Location.Y / scaleY)); Point controlPoint = e.Location; Rectangle detectionZone = _camera.GetDetectionZone(); @@ -503,9 +503,9 @@ namespace Camera Rectangle editRect = _isEditingDetectionZone ? scaledDetectionZone : scaledLedZone; int handle = GetHoveredHandle(editRect, e.Location); - if (_isResizing && handle >= 0) + if (_isResizing) { - picBoxCamera.Cursor = GetResizeCursor(handle); + picBoxCamera.Cursor = GetResizeCursor(_hoveredHandle); int dx = e.Location.X - _resizeStartPoint.X; int dy = e.Location.Y - _resizeStartPoint.Y; @@ -537,13 +537,14 @@ namespace Camera } else if (_isMoving) { - Point imagePoint = new Point((int)(e.X * scaleX), (int)(e.Y * scaleY)); - int moveDx = imagePoint.X - _startPoint.X; - int moveDy = imagePoint.Y - _startPoint.Y; + picBoxCamera.Cursor = Cursors.SizeAll; + + int dx = e.Location.X - _resizeStartPoint.X; + int dy = e.Location.Y - _resizeStartPoint.Y; Rectangle newZone = new Rectangle( - _originalZone.X + moveDx, - _originalZone.Y + moveDy, + _originalZone.X + (int)(dx / scaleX), + _originalZone.Y + (int)(dy / scaleY), _originalZone.Width, _originalZone.Height ); @@ -583,7 +584,7 @@ namespace Camera { picBoxCamera.Cursor = Cursors.SizeAll; - Point imagePoint = new Point((int)(e.X * scaleX), (int)(e.Y * scaleY)); + Point imagePoint = new Point((int)(e.Location.X / scaleX), (int)(e.Location.Y / scaleY)); int dx = imagePoint.X - _startPoint.X; int dy = imagePoint.Y - _startPoint.Y; @@ -650,9 +651,9 @@ namespace Camera return; } - float scaleX = (float)imageWidth / picBoxCamera.ClientSize.Width; - float scaleY = (float)imageHeight / picBoxCamera.ClientSize.Height; - Point imagePoint = new Point((int)(e.X * scaleX), (int)(e.Y * scaleY)); + float scaleX = (float)picBoxCamera.ClientSize.Width / imageWidth; + float scaleY = (float)picBoxCamera.ClientSize.Height / imageHeight; + Point imagePoint = new Point((int)(e.Location.X / scaleX), (int)(e.Location.Y / scaleY)); if (_isDrawing && !_isMoving) {