mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-15 11:17:53 +01:00
Fix for WPF DPI issue on .net 3.1.19 (#13551)
This commit is contained in:
@@ -26,6 +26,8 @@ namespace ImageResizer
|
|||||||
|
|
||||||
protected override void OnStartup(StartupEventArgs e)
|
protected override void OnStartup(StartupEventArgs e)
|
||||||
{
|
{
|
||||||
|
// Fix for .net 3.1.19 making Image Resizer not adapt to DPI changes.
|
||||||
|
NativeMethods.SetProcessDPIAware();
|
||||||
var batch = ResizeBatch.FromCommandLine(Console.In, e?.Args);
|
var batch = ResizeBatch.FromCommandLine(Console.In, e?.Args);
|
||||||
|
|
||||||
// TODO: Add command-line parameters that can be used in lieu of the input page (issue #14)
|
// TODO: Add command-line parameters that can be used in lieu of the input page (issue #14)
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ namespace ImageResizer.Utilities
|
|||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
internal static extern uint SendInput(uint nInputs, INPUT[] pInputs, int cbSize);
|
internal static extern uint SendInput(uint nInputs, INPUT[] pInputs, int cbSize);
|
||||||
|
|
||||||
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
|
internal static extern bool SetProcessDPIAware();
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct INPUT
|
public struct INPUT
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -93,6 +93,9 @@ namespace PowerLauncher
|
|||||||
private void OnStartup(object sender, StartupEventArgs e)
|
private void OnStartup(object sender, StartupEventArgs e)
|
||||||
{
|
{
|
||||||
Log.Info("On Startup.", GetType());
|
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();
|
var bootTime = new System.Diagnostics.Stopwatch();
|
||||||
bootTime.Start();
|
bootTime.Start();
|
||||||
Stopwatch.Normal("App.OnStartup - Startup cost", () =>
|
Stopwatch.Normal("App.OnStartup - Startup cost", () =>
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ namespace PowerLauncher.Helper
|
|||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
internal static extern IntPtr SetForegroundWindow(IntPtr hWnd);
|
internal static extern IntPtr SetForegroundWindow(IntPtr hWnd);
|
||||||
|
|
||||||
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
|
internal static extern bool SetProcessDPIAware();
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
internal static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
|
internal static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user