-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tool.cpp
56 lines (46 loc) · 2 KB
/
Tool.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include"Tool.h"
using namespace std;
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
void blue_border()
{
WORD blue_orange = FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN; //设置字体颜色、背景颜色(橙)
SetConsoleTextAttribute(hOut, blue_orange); //设置字体样式
}
void blue()
{
WORD blue = FOREGROUND_BLUE | FOREGROUND_INTENSITY; //设置为蓝色字体
SetConsoleTextAttribute(hOut, blue);
}
void white()
{
WORD white = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY;//设置字体颜色、背景颜色(白)
SetConsoleTextAttribute(hOut, white); //设置字体样式
}
void green()
{
WORD cyan = FOREGROUND_GREEN | FOREGROUND_INTENSITY; //设置字体颜色、背景颜色(青)
SetConsoleTextAttribute(hOut, cyan); //设置字体样式
}
void red() //设置为红色字体
{
WORD red = FOREGROUND_RED | FOREGROUND_INTENSITY;
SetConsoleTextAttribute(hOut, red);
}
void on_Select()
{
WORD select = FOREGROUND_GREEN | FOREGROUND_INTENSITY | BACKGROUND_RED; //设置字体颜色、背景颜色(红)
SetConsoleTextAttribute(hOut, select); //设置字体样式
}
void mode_color()
{
WORD modecolor = FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY; //设置字体颜色、背景颜色(橙)
SetConsoleTextAttribute(hOut, modecolor); //设置字体样式
}
void gotoxy(HANDLE hOut, int x, int y) //设置光标位置
{
COORD pos;
pos.Y = y;
pos.X = x;
SetConsoleCursorPosition(hOut, pos);
}