/// <summary> /// Gets the Rectangle of the console window. /// </summary> /// <returns></returns> private Rectangle GetConsoleRectangle() { Screen screen = this.GetScreen(); Win32.RECT rect = new Win32.RECT(); Win32.GetWindowRect(this.consoleProcess.MainWindowHandle, out rect); // Subtract screen position as SetConsolePosition is relative to the selected screen. return new Rectangle(rect.Left - screen.WorkingArea.X, rect.Top - screen.WorkingArea.Y, rect.Right - rect.Top, rect.Bottom - rect.Top); }