Добавлен example
This commit is contained in:
15
Lattice.Example.DragDrop/WindowExtensions.cs
Normal file
15
Lattice.Example.DragDrop/WindowExtensions.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Microsoft.UI.Xaml;
|
||||
|
||||
namespace Lattice.Example.DragDrop;
|
||||
|
||||
public static class WindowExtensions
|
||||
{
|
||||
public static void SetWindowSize(this Window window, int width, int height)
|
||||
{
|
||||
var hwnd = WinRT.Interop.WindowNative.GetWindowHandle(window);
|
||||
var windowId = Microsoft.UI.Win32Interop.GetWindowIdFromWindow(hwnd);
|
||||
var appWindow = Microsoft.UI.Windowing.AppWindow.GetFromWindowId(windowId);
|
||||
|
||||
appWindow.Resize(new Windows.Graphics.SizeInt32(width, height));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user