是否可能在.NET中以彩色写入控制台? [英] Is it possible to write to the console in colour in .NET?

查看:119
本文介绍了是否可能在.NET中以彩色写入控制台?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编写一个小命令行工具,这将是很好的输出不同的颜色。这是可能吗?

Writing a small command line tool, it would be nice to output in different colours. Is this possible?

推荐答案

是的。请参阅此文章。这里有一个例子:

Yes. See this article. Here's an example from there:

Console.BackgroundColor = ConsoleColor.Blue;
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine("White on blue.");

这篇关于是否可能在.NET中以彩色写入控制台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆