永发信息网

VC 6.0控制台颜色 利用<windows.h>

答案:1  悬赏:20  手机版
解决时间 2021-04-20 11:55
  • 提问者网友:十年饮冰
  • 2021-04-20 04:50
VC 6.0控制台颜色 利用<windows.h>
最佳答案
  • 五星知识达人网友:十年萤火照君眠
  • 2021-04-20 04:59
更改控制台颜色,只需要在程序的开始加一个语句就可以。
#include
......

int main(int argc, char* argv)
{
system("color 3e");
system("pause");

}

关于color命令请参照:
COLOR [attr]

attr Specifies color attribute of console output

Color attributes are specified by TWO hex digits -- the first
corresponds to the background; the second the foreground. Each digit
can be any of the following values:

0 = Black 8 = Gray
1 = Blue 9 = Light Blue
2 = Green A = Light Green
3 = Aqua B = Light Aqua
4 = Red C = Light Red
5 = Purple D = Light Purple
6 = Yellow E = Light Yellow
7 = White F = Bright White

If no argument is given, this command restores the color to what it was
when CMD.EXE started. This value either comes from the current console
window, the /T command line switch or from the DefaultColor registry
value.

The COLOR command sets ERRORLEVEL to 1 if an attempt is made to execute
the COLOR command with a foreground and background color that are the
same.

Example: "COLOR fc" produces light red on bright white
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯