Browse Source

Merge pull request #9695 from AvaloniaUI/rounded_corner

Windows - Set rounded corners when client is extended
pull/9763/head
Max Katz 4 years ago
committed by GitHub
parent
commit
825466a1a1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs
  2. 12
      src/Windows/Avalonia.Win32/WindowImpl.cs

8
src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs

@ -820,6 +820,14 @@ namespace Avalonia.Win32.Interop
DWMWA_LAST
};
public enum DwmWindowCornerPreference : uint
{
DWMWCP_DEFAULT = 0,
DWMWCP_DONOTROUND,
DWMWCP_ROUND,
DWMWCP_ROUNDSMALL
}
public enum MapVirtualKeyMapTypes : uint
{
MAPVK_VK_TO_VSC = 0x00,

12
src/Windows/Avalonia.Win32/WindowImpl.cs

@ -1029,6 +1029,12 @@ namespace Avalonia.Win32
{
var margins = UpdateExtendMargins();
DwmExtendFrameIntoClientArea(_hwnd, ref margins);
unsafe
{
int cornerPreference = (int)DwmWindowCornerPreference.DWMWCP_ROUND;
DwmSetWindowAttribute(_hwnd, (int)DwmWindowAttribute.DWMWA_WINDOW_CORNER_PREFERENCE, &cornerPreference, sizeof(int));
}
}
else
{
@ -1039,6 +1045,12 @@ namespace Avalonia.Win32
_extendedMargins = new Thickness();
Resize(new Size(rcWindow.Width / RenderScaling, rcWindow.Height / RenderScaling), PlatformResizeReason.Layout);
unsafe
{
int cornerPreference = (int)DwmWindowCornerPreference.DWMWCP_DEFAULT;
DwmSetWindowAttribute(_hwnd, (int)DwmWindowAttribute.DWMWA_WINDOW_CORNER_PREFERENCE, &cornerPreference, sizeof(int));
}
}
if (!_isClientAreaExtended || (_extendChromeHints.HasAllFlags(ExtendClientAreaChromeHints.SystemChrome) &&

Loading…
Cancel
Save