《c++操作窗口字体颜色设置程序.docx》由会员分享,可在线阅读,更多相关《c++操作窗口字体颜色设置程序.docx(2页珍藏版)》请在三一办公上搜索。
1、c+操作窗口字体颜色设置程序#include #include using namespace std; void main cout原色testCOLORendl; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED| FOREGROUND_GREEN|FOREGROUND_BLUE);/设置三色相加 cout白色testCOLORendl; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FORE
2、GROUND_INTENSITY|FOREGROUND_RED); /设置红色 cout红色testCOLORendl; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN) ;/设置绿色 cout绿色testCOLORendl; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE); /设置蓝色 cout蓝色testCOLOR
3、endl; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);/设置红色和绿色相加 cout黄色testCOLORendl; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);/设置红色和蓝色相加 cout粉色testCOLORendl; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);/设置绿色和蓝色相加 cout青色testCOLORendl; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY); /设置颜色,没有添加颜色,故为原色 coutendl;