ACAT.Lib.Core.Utility.User32Interop.GetWindowRect C# (CSharp) Метод

GetWindowRect() приватный Метод

private GetWindowRect ( IntPtr hWnd, [ lpRect ) : bool
hWnd System.IntPtr
lpRect [
Результат bool
        public static extern bool GetWindowRect(IntPtr hWnd, [Out] out RECT lpRect);

Usage Example

Пример #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);
        }