How to change foreground and background text color in console?
I'm writing a console C# program. I would like to change the foreground and the background color of the text in console.
Console.BackgroundColor//t set the background color for the text.
Console.ForegroundColor//to set the foreground color for the text.
Console.ResetColor();//set back the foreground color and background color to the default.
You need only to set
Console.BackgroundColor = ConsoleColor.Blue;
Console.ForegroundColor = ConsoleColor.Red;
Read all about it at http://www.dotnetperls.com/console-color
Console.ForegroundColor = ConsoleColor.Green;
Console.BackgroundColor = Console.Color.White;
链接地址: http://www.djcxy.com/p/87422.html
下一篇: 如何更改控制台中的前景和背景文字颜色?