在.NET中,是否可能以彩色方式向控制台中写入内容?
class Program { static void Main() { Console.BackgroundColor = ConsoleColor.Blue; Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("White on blue."); Console.WriteLine("Another line."); Console.ResetColor(); } }
引用自 这里。
是的。可以看看这篇文章。以下是来自该文章的示例:
Console.BackgroundColor = ConsoleColor.Blue; Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("White on blue.");