diff --git a/QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/WebpagePanel.cs b/QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/WebpagePanel.cs index 66a1bb9..e60c373 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/WebpagePanel.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/WebpagePanel.cs @@ -18,7 +18,9 @@ using System; using System.IO; using System.Text; +using System.Windows; using System.Windows.Controls; +using System.Windows.Media; using System.Windows.Threading; using QuickLook.Common.Helpers; @@ -28,7 +30,16 @@ namespace QuickLook.Plugin.HtmlViewer { public WebpagePanel() { - Zoom = (int) (100 * DpiHelper.GetCurrentScaleFactor().Vertical); + var factor = VisualTreeHelper.GetDpi(this); + Zoom = (int)(factor.DpiScaleX*100); + } + + // adjust zoom when DPI changes. + protected override void OnDpiChanged(DpiScale oldDpi, DpiScale newDpi) + { + var ratio = newDpi.DpiScaleX / oldDpi.DpiScaleX; + Zoom = (int)(Zoom * ratio); + base.OnDpiChanged(oldDpi, newDpi); } public void LoadFile(string path) diff --git a/QuickLook/App.config b/QuickLook/App.config index 01c325b..7030e0b 100644 --- a/QuickLook/App.config +++ b/QuickLook/App.config @@ -5,6 +5,7 @@ + diff --git a/QuickLook/app.manifest b/QuickLook/app.manifest index dafc5ef..37036a7 100644 --- a/QuickLook/app.manifest +++ b/QuickLook/app.manifest @@ -49,13 +49,19 @@ DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. --> - + + PerMonitor + + + true + - --> +