就是输出 白底黑字 的字符.

解决方案 »

  1.   

    System.Console.BackgroundColor = ConsoleColor.White;
                System.Console.ForegroundColor = ConsoleColor.Black;
                System.Console.Write("bbbb");
      

  2.   

    可以,相信你可以自己能自己改写下面的代码:// This example demonstrates the ConsoleColor enumeration.
    using System;class Sample 
    {
        public static void Main() 
        {
        String nl = Environment.NewLine;
        String[] colorNames = ConsoleColor.GetNames(typeof(ConsoleColor));// ---------------------------------------------------------------------------------------
        Console.WriteLine("{0}All the foreground colors on a constant black background.", nl);
        Console.WriteLine("  (Black on black is not readable.){0}", nl);    for (int x = 0; x < colorNames.Length; x++)
        {
        Console.Write("{0,2}: ", x);
        Console.BackgroundColor = ConsoleColor.Black;
        Console.ForegroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), colorNames[x]);
        Console.Write("This is foreground color {0}.", colorNames[x]);
        Console.ResetColor();
        Console.WriteLine();
        }
    // ---------------------------------------------------------------------------------------
        Console.WriteLine("{0}A constant white foreground on all the background colors.", nl);
        Console.WriteLine("  (White on white is not readable.){0}", nl);    for (int x = 0; x < colorNames.Length; x++)
        {
        Console.Write("{0,2}: ", x);
        Console.ForegroundColor = ConsoleColor.White;
        Console.BackgroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), colorNames[x]);
        Console.Write("This is background color {0}.", colorNames[x]);
        Console.ResetColor();
        Console.WriteLine();
        }
    // ---------------------------------------------------------------------------------------
        }
    }
    参考:
    Console.BackgroundColor Property 
    ms-help://MS.MSDNQTR.v90.en/fxref_mscorlib/html/31300c4a-5103-9dcd-5d36-420955f56467.htmConsole.ForegroundColor Property 
    ms-help://MS.MSDNQTR.v90.en/fxref_mscorlib/html/fd3353c4-f1c3-3605-213d-764eee238499.htm
      

  3.   

    System.Console.BackgroundColor = ConsoleColor.White; 
                System.Console.ForegroundColor = ConsoleColor.Black; 
                System.Console.Write("bbbb");