Esempio n. 1
0
        /// <summary>
        /// Fills character attributes at a given cursor position.
        /// </summary>
        /// <param name="fgColor">The foreground color to use in the fill.</param>
        /// <param name="bgColor">The background color to use in the fill.</param>
        /// <param name="numAttrs">The number of character cells to be filled with the attribute.</param>
        /// <param name="x">The column position where the fill operation is to start.</param>
        /// <param name="y">The row position where the fill operation is to start.</param>
        /// <returns>The number of character cells in which the attribute was written.</returns>
        public int FillAttributeXY(ConsoleColor fgColor, ConsoleColor bgColor, int numAttrs, int x, int y)
        {
            Coord pos = new Coord((short)x, (short)y);
            ConsoleCharAttribute attr = new ConsoleCharAttribute(fgColor, bgColor);
            int attrsWritten          = 0;

            if (!WinCon.FillConsoleOutputAttribute(_handle, attr, numAttrs, pos, ref attrsWritten))
            {
                throw new ApplicationException("Error writing attributes");
            }
            return(attrsWritten);
        }