[DllImport("user32.dll")] public static extern IntPtr GetWindowRect(IntPtr hWnd, out RECT rect); RECT rect; GetWindowRect(hWnd, out rect);
[DllImport("user32.dll")] public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int width, int height, uint flags); RECT rect; GetWindowRect(hWnd, out rect); SetWindowPos(hWnd, IntPtr.Zero, rect.left + dx, rect.top + dy, rect.right - rect.left, rect.bottom - rect.top, SetWindowPosFlags.SWP_NOZORDER | SetWindowPosFlags.SWP_NOSIZE);Package Library: The RECT structure is a part of the System.Windows.Forms namespace, which is a core library in the .NET Framework.