How to add font color to a .net console app?

2019-04-04 01:16发布

问题:

Is there a way to color the font of certain lines in a console app in .net?

Thanks

回答1:

http://msdn.microsoft.com/en-us/library/system.console.foregroundcolor.aspx

You can change the foreground and background colors of the console. The foreground color is of course the text.



回答2:

Console.BackgroundColor = ConsoleColor.Blue;
Console.ForegroundColor = ConsoleColor.Yellow;