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
| unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, StdCtrls, ExtCtrls, jpeg;
type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
Edit1: TEdit;
Timer1: TTimer;
Label1: TLabel;
Image1: TImage;
procedure MemClick(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure FormResize(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
txt:array[1..17] of string;
mem:array[1..5,1..5] of tmemo;
f:system.text;
color1,color2,fontcolor1,fontcolor2:tcolor;
i,j,n,k,razmer_shrifta,taimer:integer;
s,s1,s2,shrift,stil_shrifta,path,imya_risunka:string;
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.MemClick(Sender: TObject);
begin
TMemo(Sender).visible:=false;
end;
procedure TForm1.N1Click(Sender: TObject);
begin
Form1.FormCreate(sender);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
path:=extractfilepath(application.ExeName)+'Config.txt';
assignfile(f,path);
reset(f);
readln(f,s);
label1.Caption:='Âîïðîñ: '+s;
readln(f,s);
n:=strtoint(s);
readln(f,s);
case strtoint(s) of
1: color1:=clwhite;
2: color1:=clred;
3: color1:=clyellow;
4: color1:=clgreen;
5: color1:=clskyblue;
6: color1:=clpurple;
7: color1:=clblack;
end;
if strtoint(s) in [1,3,5] then fontcolor1:=clwindowtext else fontcolor1:=clwindow;
readln(f,s);
case strtoint(s) of
1: color2:=clwhite;
2: color2:=clred;
3: color2:=clyellow;
4: color2:=clgreen;
5: color2:=clskyblue;
6: color2:=clpurple;
7: color2:=clblack;
end;
if strtoint(s) in [1,3,5] then fontcolor2:=clwindowtext else fontcolor2:=clwindow;
readln(f,shrift);
readln(f,s);
razmer_shrifta:=strtoint(s);
readln(f,stil_shrifta);
readln(f,s);
taimer:=strtoint(s);
readln(f,imya_risunka);
imya_risunka:=extractfilepath(application.ExeName)+imya_risunka;
for i:=1 to 16 do begin
readln(f,txt[i]);
repeat
if pos('#13',txt[i])>0 then begin
j:=pos('#13',txt[i]);
delete(txt[i],j,3);
s1:=copy(txt[i],1,j-1);
s2:=copy(txt[i],j,length(txt[i])-j+1);
txt[i]:=s1+#13+s2;
end;
until pos('#13',txt[i])=0;
end;
closefile(f);
image1.Picture.LoadFromFile(imya_risunka);
image1.Width:=form1.ClientWidth;
image1.Height:=form1.ClientHeight-image1.Top;
k:=1;
For i:=1 to n do
for j:=1 to 4 do begin
mem[i,j]:=tmemo.Create(self);
mem[i,j].Create(self).OnClick:=MemClick;
mem[i,j].parent:=self;
mem[i,j].left:=trunc((j-1)*image1.Width/4);
mem[i,j].width:=trunc(image1.Width/4);
mem[i,j].Top:=trunc(image1.Top+(i-1)*image1.Height/n);
mem[i,j].Height:=trunc(image1.Height/n);
if ((i in [1,3]) and (j in [1,3])) or
((i in [2,4]) and (j in [2,4])) then begin
mem[i,j].Color:=color1;
mem[i,j].Font.Color:=fontcolor1;
end else begin
mem[i,j].Color:=color2;
mem[i,j].Font.Color:=fontcolor2;
end;
mem[i,j].Font.Name:=shrift;
mem[i,j].Font.Size:=razmer_shrifta;
if stil_shrifta='Îáû÷íûé' then mem[i,j].Font.Style:=[] else
if stil_shrifta='Ïîëóæèðíûé' then mem[i,j].Font.Style:=[fsBold] else
if stil_shrifta='Íàêëîííûé' then mem[i,j].Font.Style:=[fsItalic] else mem[i,j].Font.Style:=[fsBold,fsItalic];
mem[i,j].text:=txt[k];
k:=k+1;
mem[i,j].cursor:=crArrow;
mem[i,j].ReadOnly:=true;
end;
PostMessage(Form1.Handle, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
end;
procedure TForm1.N2Click(Sender: TObject);
begin
close;
end;
procedure TForm1.FormResize(Sender: TObject);
begin
label1.Width:=form1.ClientWidth-label1.Left*2;
image1.Width:=form1.ClientWidth;
image1.Height:=form1.ClientHeight-image1.Top;
For i:=1 to n do
for j:=1 to 4 do begin
mem[i,j].left:=trunc((j-1)*image1.Width/4);
mem[i,j].width:=trunc(image1.Width/4);
mem[i,j].Top:=trunc(image1.Top+(i-1)*image1.Height/n);
mem[i,j].Height:=trunc(image1.Height/n);
end;
end;
end. |