Fix for WPF DPI issue on .net 3.1.19 (#13551)

This commit is contained in:
Jaime Bernardo
2021-10-01 14:03:04 +01:00
committed by GitHub
parent 34e81fdf87
commit b0d35f5ef8
4 changed files with 11 additions and 0 deletions

View File

@@ -93,6 +93,9 @@ namespace PowerLauncher
private void OnStartup(object sender, StartupEventArgs e)
{
Log.Info("On Startup.", GetType());
// Fix for .net 3.1.19 making PowerToys Run not adapt to DPI changes.
PowerLauncher.Helper.NativeMethods.SetProcessDPIAware();
var bootTime = new System.Diagnostics.Stopwatch();
bootTime.Start();
Stopwatch.Normal("App.OnStartup - Startup cost", () =>

View File

@@ -40,6 +40,9 @@ namespace PowerLauncher.Helper
[DllImport("user32.dll")]
internal static extern IntPtr SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll", SetLastError = true)]
internal static extern bool SetProcessDPIAware();
[DllImport("user32.dll")]
internal static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);