window界面控制
标签:pos out att 绿色 开始 rpo namespace gre attribute
一、挂起
#include
#includeusing namespace std;
int main() {
for (int i = 10; i >= 0; i--) {
system("cls");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
cout "距离系统关闭还有:";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
cout "秒" endl;
Sleep(1000);
}
return 0;
}
二、在屏幕随机输出
#include
#includeusing namespace std;
void gotoxy(int y, int x) {
COORD pos;
pos.X = x;
pos.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
int main() {
gotoxy(8, 20);//从第5行 第20列开始输出
cout "欢迎来到信息管理系统,请求正在加载中...";
for (int i = 0; i 5; i++) {
Sleep(1000);
cout "...";
}
cout endl;
return 0;
}
三、颜色控制
#include
#includeusing namespace std;
void main()
{
cout "原色" endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN | FOREGROUND_BLUE);
cout "白色" endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
cout "红色" endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
cout "绿色" endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE);
cout "蓝色" endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
cout "黄色" endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_BLUE);
cout "粉色" endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN |FOREGROUND_BLUE);
cout "青色" endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
cout endl;
}
window界面控制
标签:pos out att 绿色 开始 rpo namespace gre attribute
原文地址:https://www.cnblogs.com/Gzu_zb/p/9374748.html
文章来自:
搜素材网的
编程语言模块,转载请注明文章出处。
文章标题:
window界面控制
文章链接:http://soscw.com/index.php/essay/68221.html
评论