就是输出 白底黑字 的字符.
解决方案 »
- C#编程中tabControl的页面Enable问题
- c# 怎么判断microsoft网络客户端是否勾选
- 求一个datagridview选中行的问题
- hook另一个进程的线程时出现的问题
- 求.net Socket通信组件
- datagridview单元格在编辑状态下,不能即时显示代码生成value值
- 存储过程调用问题
- 谁用过SystemInformation.Network?为什么返回总是true?
- 怎么可以实现画类似波形走势图?主要是保证上一次画的图形不被刷新掉
- E:\C#\新建文件夹\Convert1\Convert\Program.cs(20,21): 错误 CS0234: 命名空间“Convert”中不存在类型或命
- C# DATETIME类型 怎么操作?
- 认为高手的来!!帮帮忙...
System.Console.ForegroundColor = ConsoleColor.Black;
System.Console.Write("bbbb");
using System;class Sample
{
public static void Main()
{
String nl = Environment.NewLine;
String[] colorNames = ConsoleColor.GetNames(typeof(ConsoleColor));// ---------------------------------------------------------------------------------------
Console.WriteLine("{0}All the foreground colors on a constant black background.", nl);
Console.WriteLine(" (Black on black is not readable.){0}", nl); for (int x = 0; x < colorNames.Length; x++)
{
Console.Write("{0,2}: ", x);
Console.BackgroundColor = ConsoleColor.Black;
Console.ForegroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), colorNames[x]);
Console.Write("This is foreground color {0}.", colorNames[x]);
Console.ResetColor();
Console.WriteLine();
}
// ---------------------------------------------------------------------------------------
Console.WriteLine("{0}A constant white foreground on all the background colors.", nl);
Console.WriteLine(" (White on white is not readable.){0}", nl); for (int x = 0; x < colorNames.Length; x++)
{
Console.Write("{0,2}: ", x);
Console.ForegroundColor = ConsoleColor.White;
Console.BackgroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), colorNames[x]);
Console.Write("This is background color {0}.", colorNames[x]);
Console.ResetColor();
Console.WriteLine();
}
// ---------------------------------------------------------------------------------------
}
}
参考:
Console.BackgroundColor Property
ms-help://MS.MSDNQTR.v90.en/fxref_mscorlib/html/31300c4a-5103-9dcd-5d36-420955f56467.htmConsole.ForegroundColor Property
ms-help://MS.MSDNQTR.v90.en/fxref_mscorlib/html/fd3353c4-f1c3-3605-213d-764eee238499.htm
System.Console.ForegroundColor = ConsoleColor.Black;
System.Console.Write("bbbb");