mirror of
https://github.com/ckaczor/ChrisKaczor.Wpf.Windows.SnappingWindow.git
synced 2026-02-03 17:24:13 -05:00
Initial commit
This commit is contained in:
27
WindowInformation.cs
Normal file
27
WindowInformation.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.Drawing;
|
||||
|
||||
namespace ChrisKaczor.Wpf.Windows;
|
||||
|
||||
public class WindowInformation
|
||||
{
|
||||
private nint Handle { get; }
|
||||
public Rectangle Location { get; }
|
||||
|
||||
public WindowInformation(nint handle)
|
||||
{
|
||||
Handle = handle;
|
||||
|
||||
var windowPlacement = new PInvoke.WindowPlacement();
|
||||
PInvoke.GetWindowPlacement(Handle, ref windowPlacement);
|
||||
|
||||
var normalPosition = windowPlacement.NormalPosition;
|
||||
|
||||
Location = new Rectangle(normalPosition.X, normalPosition.Y, normalPosition.Width, normalPosition.Height);
|
||||
}
|
||||
|
||||
public WindowInformation(nint handle, Rectangle location)
|
||||
{
|
||||
Handle = handle;
|
||||
Location = location;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user