Exemplo n.º 1
0
        /// <summary>
        /// Writes character and attribute information to a rectangular portion of the screen buffer.
        /// </summary>
        /// <param name="buff">The array that contains characters and attributes to be written.</param>
        /// <param name="buffX">Column position of the first character to be written from the array.</param>
        /// <param name="buffY">Row position of the first character to be written from the array.</param>
        /// <param name="left">Column position of the top-left corner of the screen buffer area where characters are to be written.</param>
        /// <param name="top">Row position of the top-left corner of the screen buffer area where characters are to be written.</param>
        /// <param name="right">Column position of the bottom-right corner of the screen buffer area where characters are to be written.</param>
        /// <param name="bottom">Row position of the bottom-right corner of the screen buffer area where characters are to be written.</param>
        public void WriteBlock(ConsoleCharInfo[,] buff, int buffX, int buffY, int left, int top, int right, int bottom)
        {
            if (disposed)
            {
                throw new ObjectDisposedException(this.ToString());
            }
            Coord     bufferSize  = new Coord((short)buff.GetLength(1), (short)buff.GetLength(0));
            Coord     bufferPos   = new Coord((short)buffX, (short)buffY);
            SmallRect writeRegion = new SmallRect((short)left, (short)top, (short)right, (short)bottom);

            if (!WinCon.WriteConsoleOutput(_handle, buff, bufferSize, bufferPos, writeRegion))
            {
                throw new IOException("Write error.", Marshal.GetLastWin32Error());
            }
        }