public static void DockLeft(IntPtr handle = default(IntPtr)) { if (handle == default(IntPtr)) { handle = GetForegroundWindow(); } Screen sc = WindowWrapper.GetScreen(handle); WindowWrapper.Restore(handle); WindowWrapper.MoveAndResize(handle, sc.Bounds.X, sc.Bounds.Y, sc.WorkingArea.Width / 2, sc.WorkingArea.Height); }
private static void MoveToScreen(IntPtr handle, Screen sc) { int state = WindowWrapper.GetState(handle); WindowWrapper.Restore(handle); Screen curr = WindowWrapper.GetScreen(handle); Point abs = WindowWrapper.GetBounds(handle).Location; Point rel = new Point(abs.X - curr.Bounds.X, abs.Y - curr.Bounds.Y); WindowWrapper.MoveAndResize(handle, rel.X + sc.Bounds.X, rel.Y + sc.Bounds.Y); ShowWindow(handle, state); }