-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTextOutBox.cpp
202 lines (83 loc) · 2.28 KB
/
TextOutBox.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#include "stdafx.h"
#include "TextOutBox.h"
#include "MyColor.h"
TEXT_OUT_BOX TextOutBox[ TextOutBox_String_SUM ];
int hs=0;
///////////////////////////////////////////////////////////////////
void TEXT_OUT_BOX_INIT()
{
for(int n=0;n<TextOutBox_String_SUM;n++)
{
TextOutBox[n].text=_T(" ");
TextOutBox[n].TextColor = 0;
}
}
void TextOut_SongTi(int x, int y,int size,unsigned long color,CString TT,CDC *pDC) //输出宋体字
{
CFont font,*oldfont;
font.CreatePointFont(size+100,"宋体",NULL);
oldfont=pDC->SelectObject(&font);
pDC->SetTextColor(color);
pDC->SetBkMode(TRANSPARENT);
pDC->TextOut(x,y,TT);
pDC->SelectObject(oldfont);
}
void TEXT_OUT_BOX_OutAll(int X,int Y,int Size,int Spacing,CDC *pDC)
{
int x=X,y=Y;
int n;
for(n=0;n<TextOutBox_String_SUM;n++)
{
TextOut_SongTi(x, y,Size, TextOutBox[n].TextColor,TextOutBox[n].text,pDC); //输出宋体字
y+=Spacing;
}
}
void TEXT_OUT_BOX_SAY(CString text, unsigned long TextColor) //数据输入 压入数组
{
int n;
if(hs<TextOutBox_String_SUM-1)
{
TextOutBox[hs].text=text;
TextOutBox[hs].TextColor=TextColor;
hs++;
}
else
{
// hs=TextOutBox_String_SUM-1;
for(n=0;n<TextOutBox_String_SUM-1;n++)
{
TextOutBox[n].text=TextOutBox[n+1].text;
TextOutBox[n].TextColor=TextOutBox[n+1].TextColor;
}
TextOutBox[hs].text=text;
TextOutBox[hs].TextColor=TextColor;
}
}
void TEXT_OUT_BOX_SAY_2(CString text,int flag) //数据输入 压入数组
{
CString SYS_text;
CString AI_text;
CString Ren_text;
CTime time = CTime::GetCurrentTime();
CString TTime = time.Format("%H:%M:%S");
SYS_text.Format("系统: %s ",TTime);
AI_text.Format("电脑: %s ",TTime);
Ren_text.Format("我: %s ",TTime);
if(flag==0) { TEXT_OUT_BOX_SAY(SYS_text,BLUE); }
else if(flag==1) { TEXT_OUT_BOX_SAY(AI_text,BLUE); }
else if(flag==2) { TEXT_OUT_BOX_SAY(Ren_text,BLUE); }
else { TEXT_OUT_BOX_SAY(" ",BLACK); }
CString tmp_text(" ");
tmp_text+=text;
TEXT_OUT_BOX_SAY(tmp_text,BLACK);
//空行
TEXT_OUT_BOX_SAY("",WHITE);
}
void TEXT_OUT_BOX_CLS()
{
for(int n=0;n< TextOutBox_String_SUM-1 ;n++)
{
TextOutBox[n].text=_T(" ");
}
hs=0;
}