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
public
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
.