Beispiel #1
0
        public static void ResetColor()
        {
            bool succeeded;

            Interop.CONSOLE_SCREEN_BUFFER_INFO csbi = GetBufferInfo(false, out succeeded);
            if (!succeeded)
            {
                return; // For code that may be used from Windows app w/ no console
            }
            Debug.Assert(_haveReadDefaultColors, "Resetting color before we've read the default foreground color!");

            // Ignore errors here - there are some scenarios for running code that wants
            // to print in colors to the console in a Windows application.
            Interop.mincore.SetConsoleTextAttribute(OutputHandle, (short)(ushort)_defaultColors);
        }
 internal static extern bool GetConsoleScreenBufferInfo(
     IntPtr hConsoleOutput,
     out Interop.CONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo);