Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
MoveWindow to screen
var lastScreen = this.GetScreenFromRect(lastRect);
var newScreen = this.GetScreenFromRect(newRect);
if (!lastScreen.Bounds.Equals(newScreen.Bounds))
var x = (newRect.Left - newScreen.Bounds.X) + lastScreen.Bounds.X;
var y = (newRect.Top - newScreen.Bounds.Y) + lastScreen.Bounds.Y;
var width = newRect.Right - newRect.Left;
var height = newRect.Bottom - newRect.Top;
Window32API.MoveWindow(this.hWnd, x, y, width, height, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment