ACAT.Lib.Core.Utility.User32Interop.MoveWindow C# (CSharp) Méthode

MoveWindow() private méthode

private MoveWindow ( IntPtr hWnd, int x, int y, int nWidth, int nHeight, bool bRepaint ) : bool
hWnd System.IntPtr
x int
y int
nWidth int
nHeight int
bRepaint bool
Résultat bool
        public static extern bool MoveWindow(IntPtr hWnd, int x, int y, int nWidth, int nHeight, bool bRepaint);

Usage Example

Exemple #1
0
        /// <summary>
        /// Moves the specified window to the monitor other than the one it is
        ///  currently in
        /// </summary>
        /// <param name="handle">Handle to the window</param>
        public static void MoveWindowToOtherMonitor(IntPtr handle)
        {
            if (handle == IntPtr.Zero || !MultipleMonitors || Windows.IsMinimized(handle))
            {
                return;
            }

            var scr = GetMonitorForHandle(handle);

            var other = scr.Primary ? GetSecondaryMonitor() : GetPrimaryMonitor();

            if (Windows.IsMaximized(handle))
            {
                Windows.RestoreWindow(handle);
            }

            User32Interop.RECT rect;
            User32Interop.GetWindowRect(handle, out rect);
            User32Interop.MoveWindow(handle, other.WorkingArea.Left, other.WorkingArea.Top, rect.right - rect.left, rect.bottom - rect.top, true);
        }