diff --git a/DeskFrame/DeskFrame.csproj b/DeskFrame/DeskFrame.csproj index a944e97..e085717 100644 --- a/DeskFrame/DeskFrame.csproj +++ b/DeskFrame/DeskFrame.csproj @@ -12,6 +12,7 @@ ico.png Icon\ico.ico AnyCPU;x64 + app.manifest diff --git a/DeskFrame/DeskFrameWindow.xaml.cs b/DeskFrame/DeskFrameWindow.xaml.cs index 2239644..ffb6d11 100644 --- a/DeskFrame/DeskFrameWindow.xaml.cs +++ b/DeskFrame/DeskFrameWindow.xaml.cs @@ -3520,10 +3520,19 @@ private void Window_MouseMove(object sender, MouseEventArgs e) { var cursorPos = System.Windows.Forms.Cursor.Position; var windowPos = this.PointToScreen(new System.Windows.Point(0, 0)); - var windowWidth = this.ActualWidth; - var windowHeight = this.ActualHeight; - if (cursorPos.X - 10 < windowPos.X || cursorPos.X + 10 > windowPos.X + windowWidth || - cursorPos.Y - 10 < windowPos.Y || cursorPos.Y + 10 > windowPos.Y + windowHeight) + + // Set default to 1.0 in case the scale factor is 0 + double scale = _windowsScalingFactor > 0 ? _windowsScalingFactor : 1.0; + + // Convert logical size (WPF units) to physical size (monitor pixels) + var physicalWidth = this.ActualWidth * scale; + var physicalHeight = this.ActualHeight * scale; + + // Use converted physical dimensions for boundary checks + if (cursorPos.X - 10 < windowPos.X || + cursorPos.X + 10 > windowPos.X + physicalWidth || + cursorPos.Y - 10 < windowPos.Y || + cursorPos.Y + 10 > windowPos.Y + physicalHeight) { if (!_contextMenuIsOpen) { diff --git a/DeskFrame/app.manifest b/DeskFrame/app.manifest new file mode 100644 index 0000000..d29317a --- /dev/null +++ b/DeskFrame/app.manifest @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + PerMonitorV2 + true/PM + + + +