Browse Source
Merge pull request #2221 from ahopper/fix-black-area-inside-window-hi-dpi
Fix black area inside window hi dpi
pull/2124/head
Steven Kirk
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
9 additions and
5 deletions
-
src/Windows/Avalonia.Win32/WindowImpl.cs
|
|
|
@ -153,10 +153,14 @@ namespace Avalonia.Win32 |
|
|
|
|
|
|
|
public void Resize(Size value) |
|
|
|
{ |
|
|
|
var clientRect = ClientSize; |
|
|
|
if (value != clientRect) |
|
|
|
int requestedClientWidth = (int)(value.Width * Scaling); |
|
|
|
int requestedClientHeight = (int)(value.Height * Scaling); |
|
|
|
UnmanagedMethods.RECT clientRect; |
|
|
|
UnmanagedMethods.GetClientRect(_hwnd, out clientRect); |
|
|
|
|
|
|
|
// do comparison after scaling to avoid rounding issues
|
|
|
|
if (requestedClientWidth != clientRect.Width || requestedClientHeight != clientRect.Height) |
|
|
|
{ |
|
|
|
value *= Scaling; |
|
|
|
UnmanagedMethods.RECT windowRect; |
|
|
|
UnmanagedMethods.GetWindowRect(_hwnd, out windowRect); |
|
|
|
|
|
|
|
@ -165,8 +169,8 @@ namespace Avalonia.Win32 |
|
|
|
IntPtr.Zero, |
|
|
|
0, |
|
|
|
0, |
|
|
|
(int)(value.Width + (windowRect.Width - clientRect.Width)), |
|
|
|
(int)(value.Height + (windowRect.Height - clientRect.Height)), |
|
|
|
requestedClientWidth + (windowRect.Width - clientRect.Width), |
|
|
|
requestedClientHeight + (windowRect.Height - clientRect.Height), |
|
|
|
UnmanagedMethods.SetWindowPosFlags.SWP_RESIZE); |
|
|
|
} |
|
|
|
} |
|
|
|
|