-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWhiteBoard.cpp
More file actions
49 lines (42 loc) · 940 Bytes
/
Copy pathWhiteBoard.cpp
File metadata and controls
49 lines (42 loc) · 940 Bytes
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
#include "WhiteBoard.h"
WhiteBoard::WhiteBoard(const std::string& fn)
{
fname = fn;
}
int readline(FILE* fp, int tx, int ty)//read help.txt
{
char szTest[100];
int len = 0;
if (!feof(fp))
{
memset(szTest, 0, sizeof(szTest));
fgets(szTest, sizeof(szTest) - 1, fp);
outtextxy(tx, ty, szTest);
//printf("%s", szTest);
}
else
{
return 0;
}
return 1;
}
void WhiteBoard::show()
{
setfillcolor(WHITE);//设置填充颜色
int m_w = right - left;
int m_h = bottom - top;
::fillroundrect(left, top, right, bottom, 10, 10);
//char text1[50] = "HDU 数据结构作业7:校园向导";
//文字居中并显示
settextcolor(BLACK);
settextstyle(text_size, 0, text_font);
int tx = left + 20;
int ty = top + 30;
FILE* fp;
fopen_s(&fp, fname.c_str(), "r");
while (readline(fp, tx, ty))
{
ty += line_gap;
}
fclose(fp);
}