public void MovePreview(Point NewPos) {
int Xpos;
int Ypos;
if (Screen.PrimaryScreen.WorkingArea.Width - NewPos.X < this.Width + 10) {
Xpos = Screen.PrimaryScreen.WorkingArea.Width - this.Width - 10;
}
else {
Xpos = NewPos.X;
}
if (Screen.PrimaryScreen.WorkingArea.Height - NewPos.Y < this.Height + 10) {
Ypos = Screen.PrimaryScreen.WorkingArea.Height - this.Height - 10;
}
else {
Ypos = NewPos.Y;
}
try {
User32.SetWindowPos(this.Handle, (IntPtr)(-1), Xpos + 2, Ypos + 2, 0, 0,
User32.SetWindowPosFlags.IgnoreResize | User32.SetWindowPosFlags.DoNotActivate);
}
catch {
}
}