Skip to content

Instantly share code, notes, and snippets.

@Mpdreamz
Created May 29, 2011 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mpdreamz/997979 to your computer and use it in GitHub Desktop.
Save Mpdreamz/997979 to your computer and use it in GitHub Desktop.
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);
}
this.Activate();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment