From b21a007455277360127fbdaff3a653c0e351c3bf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Feb 2026 04:17:19 +0000 Subject: [PATCH] Fix DPI scaling for fullscreen mode on high-DPI displays Co-authored-by: emako <24737061+emako@users.noreply.github.com> --- QuickLook/ViewerWindow.Actions.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/QuickLook/ViewerWindow.Actions.cs b/QuickLook/ViewerWindow.Actions.cs index 223668f..c601007 100644 --- a/QuickLook/ViewerWindow.Actions.cs +++ b/QuickLook/ViewerWindow.Actions.cs @@ -108,6 +108,9 @@ public partial class ViewerWindow var screen = WinForms.Screen.FromHandle(new WindowInteropHelper(this).Handle); var screenBounds = screen.Bounds; + // Get DPI scale factor for proper coordinate conversion + var scale = DisplayDeviceHelper.GetScaleFactorFromWindow(this); + // Set to normal state first to allow manual positioning WindowState = WindowState.Normal; @@ -115,11 +118,12 @@ public partial class ViewerWindow WindowStyle = WindowStyle.None; ResizeMode = ResizeMode.NoResize; - // Set window to cover the entire screen - Left = screenBounds.Left; - Top = screenBounds.Top; - Width = screenBounds.Width; - Height = screenBounds.Height; + // Convert screen bounds from physical pixels to DIPs for WPF + var dipWidth = screenBounds.Width / scale.Horizontal; + var dipHeight = screenBounds.Height / scale.Vertical; + + // Use MoveWindow to set position and size with proper DPI handling + this.MoveWindow(screenBounds.Left, screenBounds.Top, dipWidth, dipHeight); } }