示例#1
0
        /// <summary>
        /// Sets the screen buffer size in character columns and rows.
        /// </summary>
        /// <param name="width">Desired width, in character columns, of screen buffer.</param>
        /// <param name="height">Desired height, in character rows, of screen buffer.</param>
        public void SetBufferSize(int width, int height)
        {
            if (disposed)
            {
                throw new ObjectDisposedException(this.ToString());
            }

            Coord sz = new Coord((short)width, (short)height);

            if (!WinCon.SetConsoleScreenBufferSize(_handle, sz))
            {
                throw new IOException("Unable to set screen buffer size", Marshal.GetLastWin32Error());
            }
        }