我喜欢命令提示符绿色的字体。
解决方案 »
- C#不能同时显示多个子窗体
- 我有一个c#程序,有很多winform,但每个都要调用一个函数,有什么方法可以在一个地方写好以后,所有的都能调用,用using可以吗,该怎么做呢
- 软件设计师考试?
- 如何把WinForm(framework 1.1)中TreeView的滚动条换掉?
- 请教一个文件读写关闭问题!
- 请教关于Excel导入到Access的问题!C#程序实现?
- 如何通过对象的属性名,创建对象的属性?
- 请问:在winform中listbox不能Item.add添加有value的项,请问怎么解决这个问题
- 在C#中有没有类似javascript中的函数eval?如果没有,类似的方法是什么?
- 请问 byte[] 如何转为 图片格式,(此 byte[] 是由 doc 文档转换而来的)
- 关于dataGrid ,请问怎么知道 dataGrid控件的值,是否被编辑过?
- 如何在C#里添加汇编代码
windows下还真不知道
{
[DllImport("kernel32.dll", EntryPoint="SetConsoleTextAttribute")]
static public extern bool SetConsoleTextAttribute( int hConsoleOutput, short wAttributes );
[DllImport("kernel32.dll", EntryPoint="GetStdHandle")]
static public extern int GetStdHandle( int nStdHandle ); [DllImport("kernel32.dll", EntryPoint="SetConsoleTitle")]
static public extern bool SetConsoleTitle( string title ); const int STD_INPUT_HANDLE = -10; // standard input handle
const int STD_OUTPUT_HANDLE = -11; // standard output handle
const int STD_ERROR_HANDLE = -12; // standard error handle const short FOREGROUND_BLUE = 0x0001; // text color contains blue.
const short FOREGROUND_GREEN = 0x0002; // text color contains green.
const short FOREGROUND_RED = 0x0004; // text color contains red.
const short FOREGROUND_INTENSITY = 0x0008; // text color is intensified.
const short BACKGROUND_BLUE = 0x0010; // background color contains blue.
const short BACKGROUND_GREEN = 0x0020; // background color contains green.
const short BACKGROUND_RED = 0x0040; // background color contains red.
const short BACKGROUND_INTENSITY = 0x0080; // background color is intensified. /// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
int nStdHandle = GetStdHandle( STD_OUTPUT_HANDLE );
bool bRet = SetConsoleTitle( "A green window" );
bRet = SetConsoleTextAttribute( nStdHandle, FOREGROUND_GREEN ); Console.WriteLine( "Look at the fonts." );
string result = Console.ReadLine();
}
}
.NET 2.0中Console类就直接支持改颜色
prompt