如何在控制台中更改前景和背景文本颜色?
我正在编写一个控制台C#程序。 我想在控制台中更改文本的前景色和背景色。
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.
你只需要设置
Console.BackgroundColor = ConsoleColor.Blue; Console.ForegroundColor = ConsoleColor.Red;
在https://www.dotnetperls.com/console-color上阅读所有相关内容
Console.ForegroundColor = ConsoleColor.Green; Console.BackgroundColor = Console.Color.White;
您应该能够使用以下属性(指向MSDN文档的链接):
Console.BackgroundColor
Console.ForegroundColor
上述就是C#学习教程:如何在控制台中更改前景和背景文本颜色?分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/cdevelopment/1031031.html