unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, jpeg, StdCtrls, ImgList;
type
TForm1 = class(TForm)
procedure Image9Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var teritorija: array[1..9] of TForm;
capital : TForm;
Form1: TForm1;
sk, sk2, bu, bu2, cap, i , zvalg : integer;
Cu, Tu, zvlg : TButton;
baz : array[0..1] of string;
kiti : array[0..3,5..8] of integer;
a, a2, a3, a4, a5: TMethod;
mainY : array[0..8] of TImage;
zvalgai : array[0..4] of TLabel;
zsk : TEdit;
implementation
{$R *.dfm}
procedure capitalas;
begin
baz[0]:='Capital';baz[1]:='Teritorija ';
if cap = 0 then i := 0 else i := 1;
if i=0 then begin capital := TForm.Create(form1); capital.Show;
capital.Caption := 'Capital';
end; end;
procedure haidas;
begin
teritorija[sk2].Hide;
end;
procedure TikimybeAtidengt;
var
tikimybe, siunciami , turimi : double ;
begin
siunciami:= StrToFloat(zsk.text);
turimi:= 40;
if siunciami > turimi then begin
tikimybe:= 100 ;
zvalgai[4].Caption:= 'Tikimybe atidengti zeme yra :' + FloatToStr(tikimybe) + ' %' ;
end;
if siunciami < turimi then begin
tikimybe:= siunciami*100/turimi;
zvalgai[4].Caption:= 'Tikimybe atidengti zeme yra :' + FloatToStr(tikimybe) +' %' ;
end; end;
function creates : string;
begin
teritorija[sk2] := Tform.Create(form1);
teritorija[sk2].Width:= 400;
teritorija[sk2].Height:= 300;
teritorija[sk2].Show;
for zvalg:= 1 to 4 do begin
zvalgai[zvalg]:= Tlabel.create(teritorija[1+sk2]);
with zvalgai[zvalg] do begin
if zvalg = 1 then begin zvalgai[1].Caption:='Siusti zvalgus'; Top:= 10; Left:= 150; Font.Color:=clRed; Font.Size:= 14 ; end;
if zvalg = 2 then begin zvalgai[2].Caption:='Siunciamu zvalgu skaicius : ' ; Top:= 50 ; Left := 100 ; end;
if zvalg = 3 then begin zvalgai[3].caption:='/Turimi zvalgai'; Top:=50; Left := 280 ; end;
if zvalg = 4 then begin zvalgai[4].caption:='Tikimybe atidengti zeme yra :' + ' %'; Top:= 70 ; Left := 100 ; end;
zvalgai[zvalg].Parent:=Teritorija[sk2];
inc(sk);
zsk:= TEdit.Create(Teritorija[sk2]);
zsk.Text:='';
zsk.Top:=50; zsk.Left:=235;
zsk.Parent:=teritorija[sk2]; zsk.Width:=40;
zvlg:= TButton.Create(Teritorija[sk2]);
zvlg.Caption:= 'Siusti zvalgus';
zvlg.Parent:= teritorija[sk2]; zvlg.Top:=230; zvlg.Left:=210;
teritorija[sk2].Caption := 'Teritorija: '+ inttostr(sk);
tu := TButton.Create(teritorija[1+sk2]);
tu.Caption := 'Close';
a3.Code := @haidas;
tu.OnClick := TNotifyEvent(a3);
tu.Parent := teritorija[sk2]; tu.Top := 230; tu.Left := 300;
end;end;
zsk.OnChange:= TNotifyEvent(a4);
end;
procedure TForm1.Image9Click(Sender: TObject);
begin
cap := 1;
creates;
end;
procedure hz;
begin
end;
procedure TForm1.FormCreate(Sender: TObject);
var
ski : integer;
begin
sk := 0; sk2 := 0;
form1.Color := $004E4E4E;
form1.Width := 766; form1.Height := 703;
for ski:= 0 to 8 do begin
mainY[ski] := TImage.Create(Form1);
with mainY[ski] do begin
Parent := Form1;
Picture.LoadFromFile('system/images/black.jpg');
Height := 209; width := 185;
if ski = 0 then begin top:=20; left:=20; end;
if ski = 1 then begin top:=10+209; left:= 20; end;
if ski = 2 then begin top:=420; left:= 20; end;
if ski = 3 then begin top:=20; left:=35+185; end;
if ski = 4 then begin top:=10+209; left:=35+185; end;
if ski = 5 then begin top:= 420; left:=35+185; end;
if ski = 6 then begin top:= 20; left:=20+185+185+30; end;
if ski = 7 then begin top:= 10+209; left:=20+185+185+30; end;
if ski = 8 then begin top:= 420; left:=20+185+185+30; end;
end;
end;
a.Code := @creates;
a2.Code := @capitalas;
a4.Code:= @TikimybeAtidengt;
a5.code:= @hz;
mainY[4].Onclick := TNotifyEvent(a2);
mainY[0].OnClick := TNotifyEvent(a);
end;
end.