No FrameHandler in WinUI for now... its too complex and broken

This commit is contained in:
Dan Clark
2024-11-18 22:20:25 +00:00
parent 0cc13bfe23
commit 748487031d
7 changed files with 44 additions and 14 deletions
+13 -1
View File
@@ -10,6 +10,7 @@ using Windows.Win32.UI.WindowsAndMessaging;
using Toolkit.Windows;
using Rect = Windows.Foundation.Rect;
using WinUIEx;
using Windows.Graphics;
namespace Toolkit.UI.WinUI;
@@ -34,6 +35,17 @@ public static partial class WindowExtensions
}
}
public static void SetSize(this Window window,
int width,
int height)
{
nint handle = WindowNative.GetWindowHandle(window);
if (handle == 0) return;
float value = PInvoke.GetDpiForWindow(new HWND(handle)) / 96f;
window.AppWindow.Resize(new SizeInt32((int)(width * (double)value), (int)(height * (double)value)));
}
public static void MoveAndResize(this Window window,
Rect rect)
{
@@ -48,7 +60,7 @@ public static partial class WindowExtensions
}
public static void SetBorderless(this Window window,
bool value)
bool value)
{
WindowStyle windowStyle = window.GetWindowStyle();