public static void MoveWindow(IntPtr id, int x, int y) { var rect = new Bounds(); GetWindowRect(id, ref rect); var width = rect.Right - rect.Left; var height = rect.Bottom - rect.Top; x -= width / 2; y -= height / 2; MoveWindow(id, x, y, width, height, true); }
internal static extern bool GetWindowRect(IntPtr hWnd, ref Bounds rect);