Exemple #1
0
        public static void DockLeft(IntPtr handle = default(IntPtr))
        {
            if (handle == default(IntPtr))
            {
                handle = GetForegroundWindow();
            }
            Screen sc = WindowWrapper.GetScreen(handle);

            WindowWrapper.Restore(handle);
            WindowWrapper.MoveAndResize(handle, sc.Bounds.X, sc.Bounds.Y, sc.WorkingArea.Width / 2, sc.WorkingArea.Height);
        }
Exemple #2
0
        private static void MoveToScreen(IntPtr handle, Screen sc)
        {
            int state = WindowWrapper.GetState(handle);

            WindowWrapper.Restore(handle);
            Screen curr = WindowWrapper.GetScreen(handle);
            Point  abs  = WindowWrapper.GetBounds(handle).Location;
            Point  rel  = new Point(abs.X - curr.Bounds.X, abs.Y - curr.Bounds.Y);

            WindowWrapper.MoveAndResize(handle, rel.X + sc.Bounds.X, rel.Y + sc.Bounds.Y);
            ShowWindow(handle, state);
        }
Exemple #3
0
        public static void BackScreen(IntPtr handle = default(IntPtr))
        {
            if (handle == default(IntPtr))
            {
                handle = GetForegroundWindow();
            }
            Screen sc = WindowWrapper.GetScreen(handle);

            Screen[] all = Screen.AllScreens;
            int      num = all.Length - 1;

            for (int i = 1; i < all.Length - 1; i++)
            {
                if (sc.Equals(all[i]))
                {
                    num = i - 1;
                    break;
                }
            }
            MoveToScreen(handle, all[num]);
        }