示例#1
0
        private static Win32Console.CHAR_INFO[] CreateBuffer(short length, ConsoleColor foreground, ConsoleColor background)
        {
            short attribute = ConsoleColorToColorAttribute(foreground, background);
            var   buffer    = new Win32Console.CHAR_INFO[length];

            for (int i = 0; i < buffer.Length; i++)
            {
                buffer[i].attributes = attribute;
            }

            return(buffer);
        }
示例#2
0
        private static Win32Console.CHAR_INFO[] CreateBuffer(string text, ConsoleColor foreground, ConsoleColor background)
        {
            short attribute = ConsoleColorToColorAttribute(foreground, background);
            var   buffer    = new Win32Console.CHAR_INFO[text.Length];
            var   index     = 0;

            foreach (var c in text)
            {
                buffer[index].charData   = c;
                buffer[index].attributes = attribute;
                index++;
            }

            return(buffer);
        }