mirror of
https://github.com/ckaczor/Common.Wpf.git
synced 2026-01-17 17:23:20 -05:00
Clean up other window checking for snapping windows
This commit is contained in:
30
Windows/WindowInformation.cs
Normal file
30
Windows/WindowInformation.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Common.Native;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Common.Wpf.Windows
|
||||
{
|
||||
public class WindowInformation
|
||||
{
|
||||
public IntPtr Handle { get; private set; }
|
||||
public Rectangle Location { get; private set; }
|
||||
|
||||
public WindowInformation(IntPtr handle)
|
||||
{
|
||||
Handle = handle;
|
||||
|
||||
var windowPlacement = new Structures.WindowPlacement();
|
||||
Functions.User32.GetWindowPlacement(Handle, ref windowPlacement);
|
||||
|
||||
var normalPosition = windowPlacement.NormalPosition;
|
||||
|
||||
Location = new Rectangle(normalPosition.X, normalPosition.Y, normalPosition.Width, normalPosition.Height);
|
||||
}
|
||||
|
||||
public WindowInformation(IntPtr handle, Rectangle location)
|
||||
{
|
||||
Handle = handle;
|
||||
Location = location;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user