close

Вход

Забыли?

вход по аккаунту

?

ПРИЛОЖЕНИЕ 4

код для вставкиСкачать

ПРИЛОЖЕНИЕ 4
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Htmlview, ComCtrls,unit2, ExtCtrls, StdCtrls,htmlsubs,OleCtrls, ShockwaveFlashObjects_TLB;
type
TForm1 = class(TForm)
button1: TImage;
button5: TImage;
button6: TImage;
button2: TImage;
button4: TImage;
button8: TImage;
Glossbutton: TImage;
TreeView1: TTreeView;
HTMLViewer1: THTMLViewer;
fon: TImage;
Edit1: TEdit;
button3: TImage;
Image1: TImage;
Image2: TImage;
procedure FormCreate(Sender: TObject);
procedure button6MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure button6MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure button5MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure button5MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure GlossbuttonMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure GlossbuttonMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure button8MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure button8MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure button4MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure button4MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure button2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure button2MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure button1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure button1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure button3MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure button3MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Image2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Image2MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure TreeView1Change(Sender: TObject; Node: TTreeNode);
procedure button6Click(Sender: TObject);
procedure button5Click(Sender: TObject);
procedure button1Click(Sender: TObject);
procedure GlossbuttonClick(Sender: TObject);
procedure HTMLViewer1HotSpotClick(Sender: TObject; const SRC: String;
var Handled: Boolean);
procedure button2Click(Sender: TObject);
procedure button4Click(Sender: TObject);
procedure button3Click(Sender: TObject);
procedure Image2Click(Sender: TObject);
procedure HTMLViewer1ObjectTag(Sender: TObject; Panel: ThvPanel;
const Attributes, Params: TStringList; var WantPanel: Boolean);
procedure HTMLViewer1PanelDestroy(Sender: TObject; Panel: ThvPanel);
procedure button8Click(Sender: TObject);
procedure htmlviewer1Destroy(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
treecr,treecr1,testbool:boolean;
numberlec:ttreenode;
sfind:string;
poiskproc:boolean;
flash: tshockwaveflash;
implementation
{$R *.dfm}
function poisk (var str,sf:string):boolean;
var i,j,y,start,finish,dsf,pos,dmas,l:integer;
table: array [0..255] of integer;
testbool,alf,ex,res:boolean;
begin
alf:=false;
{make table}
for i:=0 to 255 do
table[i]:=length(sf);
for i:=length(sf) downto 1 do
if table[byte(sf[i])]=length(sf) then
begin
table[byte(sf[i])]:=length(sf)-i;
if ((byte(sf[i])>223) and (byte(sf[i])<255))or (byte(sf[i])=255) then
begin
table[byte (sf[i])-32]:= length(sf)-i;
alf:=true
end
else
table[byte(upcase(sf[i]))]:=length(sf)-i;
end;
j:=0;
res:=false;
ex:=true;
while ex<>false do
begin
start:=0;
finish:=0;
{poisk start i finisha}
while (finish=0) do
begin
inc(j);
if (str[j]='<') then
begin
if start=0 then
begin
while (str[j]<>'>') do
inc(j);
if j=length(str) then
begin
ex:=false;
break;
end;
if (str[j+1]<>'<') then
start:=j+1 ;
end
else
finish:=j-1;
end;
end;
{}
{poisk slova}
if (start<>0) and (res<>true)then
begin
res:=false;;
dsf:=length(sf);
pos:=start+dsf-1;
while ((pos<(finish+1)) and (res=false)) do
begin
if alf=true then
begin
if (sf[dsf]<>str[pos]) and (byte(sf[dsf])-32<>byte(str[pos])) then
pos:=pos+table[byte(str[pos])]
else
for i:=dsf-1 downto 1 do
if (sf[i]<>str[pos-dsf+i]) and((byte(sf[i])-32)<>(byte(str[pos-dsf+i]))) then
begin
inc(pos);
break;
end
else if i=1 then
begin
res:=true;
break;
end;
end
else
begin
if (sf[dsf]<>str[pos]) and (upcase(sf[dsf])<>str[pos]) then
pos:=pos+table[byte(str[pos])]
else
for i:=dsf-1 downto 1 do
if (sf[i]<>str[pos-dsf+i]) and(upcase(sf[i])<>str[pos-dsf+i]) then
begin
inc(pos);
break;
end
else if i=1 then
begin
res:=true;
break;
end;
end;
end;
{}
j:=finish;
end;
end;
if res=true then result:=true else result:=false;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
form1.Top:=(screen.Height-form1.Height)div 2;
form1.Left:=(screen.Width-form1.Width) div 2;
fon.Picture.LoadFromFile('fon.bmp');
button1.Picture.LoadFromFile('Skrit_menu.bmp');
button5.Picture.LoadFromFile('back.bmp');
button6.Picture.LoadFromFile('next.bmp');
glossbutton.Picture.LoadFromFile('glossariy.bmp');
button8.Picture.LoadFromFile('test.bmp');
button4.Picture.LoadFromFile('poisk.bmp');
button2.Picture.LoadFromFile('print.bmp');
button3.Picture.LoadFromFile('find.bmp');
image1.Picture.LoadFromFile('find_fon.bmp');
edit1.Visible:=false;
image1.Visible:=false;
button3.Visible:=false;
image2.Visible:=false;
image2.Picture.LoadFromFile('find_next.bmp');
treeview1.LoadFromFile('filelist.txt');
numberlec:=treeview1.Items.Item[0];
numberlec.Selected:=true;
end;
procedure TForm1.button6MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
button6.Picture.LoadFromFile('next_d.bmp');
end;
procedure TForm1.button6MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
button6.Picture.LoadFromFile('next.bmp');
end;
procedure TForm1.button5MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
button5.Picture.LoadFromFile('back_d.bmp');
end;
procedure TForm1.button5MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
button5.Picture.LoadFromFile('back.bmp');
end;
procedure TForm1.GlossbuttonMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
glossbutton.Picture.LoadFromFile('glossariy_d.bmp');
end;
procedure TForm1.GlossbuttonMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
glossbutton.Picture.LoadFromFile('glossariy.bmp');
end;
procedure TForm1.button8MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
button8.Picture.LoadFromFile('test_d.bmp');
end;
procedure TForm1.button8MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
button8.Picture.LoadFromFile('test.bmp');
end;
procedure TForm1.button4MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if edit1.Visible=false then
button4.Picture.LoadFromFile('poisk_d.bmp')else
button4.Picture.LoadFromFile('lec_d.bmp');
end;
procedure TForm1.button4MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if edit1.Visible=false then
button4.Picture.LoadFromFile('poisk.bmp')
else button4.Picture.LoadFromFile('lec.bmp');
end;
procedure TForm1.button2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
button2.Picture.LoadFromFile('print_d.bmp');
end;
procedure TForm1.button2MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
button2.Picture.LoadFromFile('print.bmp');
end;
procedure TForm1.button1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if treeview1.Visible=true then
button1.Picture.LoadFromFile('skrit_menu_d.bmp')
else
button1.Picture.LoadFromFile('otkrit_menu_d.bmp');
end;
procedure TForm1.button1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if treeview1.Visible=true then
button1.Picture.LoadFromFile('skrit_menu.bmp')else
button1.Picture.LoadFromFile('otkrit_menu.bmp');
end;
procedure TForm1.button3MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
button3.Picture.LoadFromFile('find_d.bmp');
end;
procedure TForm1.button3MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
button3.Picture.LoadFromFile('find.bmp');
end;
procedure TForm1.Image2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
image2.Picture.LoadFromFile('find_next_d.bmp');
end;
procedure TForm1.Image2MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
image2.Picture.LoadFromFile('find_next.bmp');
end;
procedure TForm1.TreeView1Change(Sender: TObject; Node: TTreeNode);
var mynode:ttreenode;
i,name:string;
begin
if poiskproc<>true then
begin
mynode:=treeview1.Selected;
if (mynode.AbsoluteIndex=0) then
button5.Enabled:=false
else
button5.Enabled:=true;
if mynode.AbsoluteIndex=(treeview1.Items.Count-1) then
button6.Enabled:=false else button6.Enabled:=true;
i:=mynode.Text;
name:=i+'.htm';
numberlec:=mynode;
HTMLViewer1.LoadFromFile(name);
end;
end;
procedure TForm1.button6Click(Sender: TObject);
var name:string;
begin
if numberlec.AbsoluteIndex=0 then
button5.Enabled:=true;
numberlec:=numberlec.GetNext;
if treeview1.Visible=true then
begin
treeview1.SetFocus;
numberlec.Selected:=true;
end;
name:=numberlec.Text+'.htm';
htmlviewer1.LoadFromFile(name);
if numberlec.AbsoluteIndex=(treeview1.Items.Count-1) then
button6.Enabled:=false;
end;
procedure TForm1.button5Click(Sender: TObject);
var name:string;
begin
numberlec:=numberlec.GetPrev; name:=numberlec.Text+'.htm';
htmlviewer1.LoadFromFile(name);
if treeview1.Visible=true then
begin
treeview1.SetFocus;
numberlec.Selected:=true;
end;
if numberlec.AbsoluteIndex=0 then
button5.Enabled:=false;
if numberlec.AbsoluteIndex<(treeview1.Items.Count-1) then
button6.Enabled:=true;
end;
procedure TForm1.button1Click(Sender: TObject);
begin
if treeview1.Visible=true then
begin
treeview1.Visible:=false;
button1.Picture.LoadFromFile('otkrit_menu.bmp');
htmlviewer1.Width:=945;
htmlviewer1.Left:=40;
end else
begin
treeview1.Visible:=true;
treeview1.SetFocus;
numberlec.Selected:=true;
button1.Picture.LoadFromFile('skrit_menu.bmp');
htmlviewer1.Width:=761;
htmlviewer1.Left:=240;
end;
end;
procedure TForm1.GlossbuttonClick(Sender: TObject);
begin
htmlviewer1.LoadFromFile('glossariy.htm');
end;
procedure TForm1.HTMLViewer1HotSpotClick(Sender: TObject;
const SRC: String; var Handled: Boolean);
var s,name:string;
j,k:integer;
mynode:ttreenode;
begin
Handled := false;
k:=length(htmlviewer1.LinkAttributes.Values['href'])-10;
for j:=1 to k do
name:=name+ htmlviewer1.LinkAttributes.Values['href'][j];
if testbool=true then
begin
poiskproc:=true;
testbool:=false;
treeview1.Items.Clear;
treeview1.LoadFromFile('filelist.txt');
poiskproc:=false;
end;
if treeview1.Visible=false then
begin
treeview1.Visible:=true;
button1.Picture.LoadFromFile('skrit_menu.bmp');
htmlviewer1.Width:=761;
htmlviewer1.Left:=240;;
end;
poiskproc:=true;
for j:=0 to treeview1.Items.Count-1 do
begin
mynode:=treeview1.Items.Item[j];
if mynode.Text=name then
begin
poiskproc:=false;
mynode.Selected:=true;
treeview1.SetFocus;
end;
end;
end;
procedure TForm1.button2Click(Sender: TObject);
var i:integer;
s:string;
begin
i:=htmlviewer1.NumPrinterPages;
case i of
1: s:='Печатать '+inttostr(i)+' страницу?';
2..4: s:='Печатать '+inttostr(i)+' страницы?';
5..20:s:='Печатать '+inttostr(i)+' страниц?';
end;
if MessageDlg(s,
mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
Htmlviewer1.OpenPrint;
Htmlviewer1.Print(1, htmlviewer1.NumPrinterPages);
Htmlviewer1.ClosePrint;
end;
end;
procedure TForm1.button4Click(Sender: TObject);
var node:ttreenode;
f,f1: textfile;
i,index:integer;
name,namedir:string;
begin
if (edit1.Visible=false) and (testbool=false) then
begin
button4.Left:= 840;
button3.Visible:=true;
edit1.Visible:=true;
image1.Visible:=true;
button4.Picture.LoadFromFile('lec.bmp');
end
else
begin
if edit1.Visible=true then
begin
if treeview1.Visible=false then
begin
treeview1.Visible:=true;
htmlviewer1.Left:=240;
htmlviewer1.Width:=817;
button1.Picture.LoadFromFile('skrit_menu.bmp');
end;
if treecr1=true then
begin
treecr1:=false;
treecr:=false;
image2.Visible:=false;
poiskproc:=true;
treeview1.Items.Clear;
treeview1.LoadFromFile('filelist.txt');
poiskproc:=false;
numberlec:=treeview1.Items.Item[0];
treeview1.SetFocus;
numberlec.Selected:=true;
end;
button4.Left:= 608;
edit1.Text:='введите слово';
edit1.Visible:=false;
button3.Visible:=false;
image1.Visible:=false;
button4.Picture.LoadFromFile('poisk.bmp');
end else
begin
poiskproc:=true;
treeview1.Items.Clear;
treeview1.LoadFromFile('filelist.txt');
poiskproc:=false;
treeview1.SetFocus;
numberlec:=treeview1.Items.Item[0];
numberlec.Selected:=true;
button4.Picture.LoadFromFile('poisk.bmp');
testbool:=false;
end;
end;
end;
procedure TForm1.button3Click(Sender: TObject);
var
f,fl: textfile;
str,s,sf,fname,name:string;
i:integer;
mynode:ttreenode;
fstr:boolean;
begin
poiskproc:=true;
treecr:=false;
if length(edit1.Text)<>1 then
begin
fstr:=false;
assignfile(fl,'filelist.txt');
reset(fl);
while Not (EOF(Fl)) do
begin
str:='';
fname:='';
readln(fl,name);
fname:=name+'.htm';
assignfile(f,fname);
reset (f);
while Not EOF(F) do
begin
Readln(F, S) ;
str:=str+s;
end;
CloseFile(f);
sf:=edit1.Text;
sfind:=sf;
if poisk(str,sf)=true then
begin
if treecr=false then
begin
if treeview1.Visible=false then
begin
treeview1.Visible:=true;
htmlviewer1.Width:=761;
htmlviewer1.Left:=240; end;
treeview1.Items.Clear;
treeview1.Items.Add(nil,name);
image2.Visible:=true;
htmlviewer1.LoadFromFile(fname);
treecr:=true;
treecr1:=true;
end
else
begin
mynode:=TreeView1.Items.Item[TreeView1.Items.Count-1];
treeview1.Items.Add(mynode,name);
end;
numberlec:=treeview1.Items.Item[0];
numberlec.Selected:=true;
treeview1.SetFocus;
button5.Enabled:=false;
end;
end;
closefile(fl);
end;
if treecr=false then
application.MessageBox('Ничего не найдено','Поиск',mb_ok);
poiskproc:=false;
end;
procedure TForm1.Image2Click(Sender: TObject);
var s:string;
begin
htmlviewer1.Find(sfind,false);
end;
procedure TForm1.HTMLViewer1ObjectTag(Sender: TObject; Panel: ThvPanel;
const Attributes, Params: TStringList; var WantPanel: Boolean);
var s:string;
begin
wantpanel:=true;
flash:=tshockwaveflash.Create(panel);
flash.Width:=panel.Width;
flash.Height:=panel.Height;
flash.Parent:=panel;
panel.BorderStyle:= bsnone;
s:=params.Values['movie'];
flash.Movie:=ExtractFilePath(Application.ExeName)+s;
end;
procedure TForm1.HTMLViewer1PanelDestroy(Sender: TObject; Panel: ThvPanel);
begin
panel.DestroyComponents;
end;
procedure TForm1.button8Click(Sender: TObject);
var i,l,j:integer;
s:string;
begin
testbool:=true;
form2:=tform2.Create(self);
form2.top:=form1.top;
form2.left:=form1.left;
form2.Width:=form1.Width;
form2.Height:=form1.Height;
if treeview1.visible=false then
begin
treeview1.Visible:=true;
treeview1.SetFocus;
numberlec.Selected:=true;
button1.Picture.LoadFromFile('skrit_menu.bmp');
htmlviewer1.Width:=761;
htmlviewer1.Left:=240;
end;
form1.Visible:=false;
form2.Visible:=true;
i:=0;
assignfile (f,'test.txt');
reset(f);
while not(eof(f)) do
begin
inc(i);
j:=1;
repeat
begin
readln(f,test[i].qw[j]);
inc(j);
end;
until test[i].qw[j-1]='ans';
test[i].qw[j-1]:='';
readln(f,test[i].ans);
readln(f,test[i].filename);
readln(f,s);
test[i].rightans:=strtoint(s);
end;
closefile(f);
lastqw:=i;
s:='';
right:=0;
numberqw:=1;
j:=0;
i:=2;
l:=length(test[1].ans)+1;
countqw:=0;
while i<>l do
begin
while (test[1].ans[i]<>'-') and (i<>l) do
begin
s:=s+test[1].ans[i];
inc(i);
end;
if i<>l then
inc(i);
inc(countqw);
inc(j);
form2.mycreateradiobutton(j,s);
s:='';
right:=0;
wrong:=0;
numberqw:=1;
end;
for l:=1 to 7 do
form2.Memo1.Lines.Add(test[1].qw[l]);
form2.label2.Caption:=form2.memo1.Text;
end;
procedure TForm1.htmlviewer1Destroy(Sender: TObject);
begin
flash.Free;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
htmlviewer1.Clear;
end;
end.
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,ComCtrls, ExtCtrls;
type
TForm2 = class(TForm)
Memo1: TMemo;
Label1: TLabel;
nextbutton: TImage;
breaktest: TImage;
closebutton: TImage;
repeatlec: TImage;
Label2: TLabel;
fon1: TImage;
procedure nextbuttonClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure breaktestMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure breaktestMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure nextbuttonMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure nextbuttonMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure repeatlecMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure repeatlecMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure closebuttonMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure closebuttonMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure closebuttonClick(Sender: TObject);
procedure repeatlecClick(Sender: TObject);
procedure breaktestClick(Sender: TObject);
private
{ Private declarations }
public
procedure mycreateradiobutton( var j:integer;s:string);
{ Public declarations }
end;
type
ttest=record
qw:array [1..7] of string;
filename,ans:string;
rightans:integer;
end;
var
Form2: TForm2;
f:textfile;
test:array [1..30] of ttest;
lastqw,countqw,numberqw,right,wrong:integer;
btn: array [1..6] of tradiobutton;
studylec:array [1..16]of string;
implementation
{$R *.dfm}
uses unit1;
procedure tform2.mycreateradiobutton( var j:integer;s:string);
begin
btn[j]:=TradioButton.Create(Form2);
btn[j].Parent:=Form2;
if j=1 then
btn[j].Top:=304 else
btn[j].Top:= btn[j-1].Top+70;
btn[j].Left:=232;
btn[j].Width:=600;
btn[j].Height:=50;
btn[j].Font.Size:=12;
btn[j].Caption:=s;
end;
procedure TForm2.nextbuttonClick(Sender: TObject);
var i,l,j:integer;
s:string;
t,boolright:boolean;
begin
memo1.Clear;
boolright:=true;
if btn[test[numberqw].rightans].Checked then begin boolright:=false;
inc(right);
label1.Font.Color:=clgreen;
label1.Caption:='Правильно';
end
else begin
label1.Font.Color:= clred;
label1.Caption:='Неверно!';
if wrong>0 then
begin
t:=false;
for i:=1 to wrong do
if studylec[i]=test[numberqw].filename then
begin
t:=true;
break;
end;
if t=false then
begin inc(wrong);
studylec[wrong]:=test[numberqw].filename;
end;
end
else begin
inc(wrong);
studylec[wrong]:=test[numberqw].filename;
end;
end;
if (numberqw<>lastqw) then
begin
inc(numberqw);
for j:=1 to 7 do
Memo1.Lines.Add(test[numberqw].qw[j]);
label2.Caption:=memo1.Text;
for j:=1 to countqw do
btn[j].free;
j:=0;
i:=2;
l:=length(test[numberqw].ans)+1;
countqw:=0;
while i<>l do
begin
while (test[numberqw].ans[i]<>'-') and (i<>l) do
begin
s:=s+test[numberqw].ans[i];
inc(i);
end;
if i<>l then
inc(i);
inc(countqw);
inc(j);
mycreateradiobutton(j,s);
s:='';
end;
end else
begin
for j:=1 to countqw do
btn[j].Destroy;
breaktest.Visible:=false;
memo1.Lines.Add('Вы ответили верно на '+inttostr(right)+' вопросов из'+inttostr(lastqw));
if wrong>0 then
begin
memo1.Lines.Add('Вам необходимо повторить: ');
for i:=1 to wrong do
memo1.Lines.Add(studylec[i]);
label1.Visible:=false;
repeatlec.Visible:=true;
end;
label2.Caption:=memo1.Text;
nextbutton.Visible:=false;
closebutton.Visible:=true;
end;
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
memo1.Text:='';
fon1.Picture.LoadFromFile('testfon.bmp');
testbool:=false;
memo1.Visible:=false;
nextbutton.Picture.LoadFromFile('answer.bmp');
breaktest.Picture.LoadFromFile('break_test.bmp');
repeatlec.Picture.LoadFromFile('repeat.bmp');
repeatlec.Visible:=false;
closebutton.Picture.LoadFromFile('close.bmp');
closebutton.Visible:=false;
end;
procedure TForm2.breaktestMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
breaktest.Picture.LoadFromFile('break_test_d.bmp');
end;
procedure TForm2.breaktestMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
breaktest.Picture.LoadFromFile('break_test.bmp');
end;
procedure TForm2.nextbuttonMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
nextbutton.Picture.LoadFromFile('answer_d.bmp');
end;
procedure TForm2.nextbuttonMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
nextbutton.Picture.LoadFromFile('answer.bmp');
end;
procedure TForm2.repeatlecMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
repeatlec.Picture.LoadFromFile('repeat_d.bmp');
end;
procedure TForm2.repeatlecMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
repeatlec.Picture.LoadFromFile('repeat.bmp');
end;
procedure TForm2.closebuttonMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
closebutton.Picture.LoadFromFile('close.bmp');
end;
procedure TForm2.closebuttonMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
closebutton.Picture.LoadFromFile('close_d.bmp');
end;
procedure TForm2.closebuttonClick(Sender: TObject);
begin
form1.Visible:=true;
form2.Close;
end;
procedure TForm2.repeatlecClick(Sender: TObject);
var i:integer;
mynode:ttreenode;
s:string;
begin
form1.Visible:=true;
form2.Visible:=false;
poiskproc:=true;
form1.TreeView1.Items.Clear;
for i:=1 to wrong do
if form1.TreeView1.Items.Count=0 then
form1.TreeView1.Items.Add(nil,studylec[i])else
begin
mynode:=form1.treeview1.items.item[form1.TreeView1.Items.count-1];
form1.TreeView1.Items.Add(mynode,studylec[i]);
end;
numberlec:=form1.treeview1.Items.Item[0];
numberlec.Selected:=true;
form1.treeview1.SetFocus;
form1.button5.Enabled:=false;
if form1.treeview1.items.count=1 then
form1.button6.enabled:=false;
form1.Button4.Picture.LoadFromFile('lec.bmp');
testbool:=true;
poiskproc:=false;
form2.Close;
end;
procedure TForm2.breaktestClick(Sender: TObject);
var i,j:integer;
begin
closebutton.Visible:=true;
nextbutton.Visible:=false;
breaktest.Visible:=false;
memo1.Clear;
for j:=1 to countqw do
btn[j].Destroy;
memo1.Lines.Add('Вы ответили верно на '+inttostr(right)+' вопросов из'+inttostr(numberqw-1));
if wrong>0 then
begin
memo1.lines.Add('Вам необходимо повторить: ');
for i:=1 to wrong do
memo1.Lines.Add(studylec[i]);
repeatlec.Visible:=true;
end;
label2.Caption:=memo1.Text;
label1.Caption:='';
end;
end.
Документ
Категория
Рефераты
Просмотров
27
Размер файла
123 Кб
Теги
приложение
1/--страниц
Пожаловаться на содержимое документа