Skip to content

Commit 90bd9b4

Browse files
CopilotBornToBeRoot
andcommitted
Send WM_DPICHANGED_AFTERPARENT to embedded window on DPI change
Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com>
1 parent 60b7562 commit 90bd9b4

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

Source/NETworkManager.Utilities/NativeMethods.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ public enum WindowShowStyle : uint
3939

4040
public enum WM : uint
4141
{
42-
SYSCOMMAND = 0x0112
42+
SYSCOMMAND = 0x0112,
43+
DPICHANGED_AFTERPARENT = 0x02E3
4344
}
4445

4546
#endregion

Source/NETworkManager/Controls/PowerShellControl.xaml.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ private void WindowGrid_SizeChanged(object sender, SizeChangedEventArgs e)
2323

2424
private void WindowsFormsHost_DpiChanged(object sender, DpiChangedEventArgs e)
2525
{
26+
if (IsConnected && _appWin != IntPtr.Zero)
27+
NativeMethods.SendMessage(_appWin, (uint)NativeMethods.WM.DPICHANGED_AFTERPARENT, IntPtr.Zero,
28+
IntPtr.Zero);
29+
2630
ResizeEmbeddedWindow();
2731
}
2832

Source/NETworkManager/Controls/PuTTYControl.xaml.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ private void WindowGrid_SizeChanged(object sender, SizeChangedEventArgs e)
2424

2525
private void WindowsFormsHost_DpiChanged(object sender, DpiChangedEventArgs e)
2626
{
27+
if (IsConnected && _appWin != IntPtr.Zero)
28+
NativeMethods.SendMessage(_appWin, (uint)NativeMethods.WM.DPICHANGED_AFTERPARENT, IntPtr.Zero,
29+
IntPtr.Zero);
30+
2731
ResizeEmbeddedWindow();
2832
}
2933

0 commit comments

Comments
 (0)