mirror of
https://github.com/ckaczor/ChrisKaczor.Wpf.Windows.SnappingWindow.git
synced 2026-01-14 01:25:43 -05:00
27 lines
682 B
C#
27 lines
682 B
C#
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;
|
|
}
|
|
} |