unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Jpeg, Contnrs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
procedure clickas(Sender: TObject);
public
{ Public declarations }
end;
var
Form1: TForm1;
img : array[1..4] of TImage;
Formos : array[1..4] of TForm;
labelis : array[1..4] of TLabel;
r, a : integer;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var i: integer;
begin
for i:=1 to 4 do begin
img[i]:= TImage.Create(form1);
with img[i] do begin
Picture.LoadFromFile('failas.jpg');
Tag:=i;
width:=65; Height:=65;
if i in [1,2] then Top:=15;
if i in [3,4] then Top:= 85;
if i in [1,3] then left:= 150;
if i in [2,4] then left:= 220;
Parent:=form1;
end;
end;
for i:=1 to 4 do begin
formos[i]:= Tform.Create(form1);
with formos[i] do begin
Tag:=i;
Width:=100;height:=100;
Parent:=form1; end;
Labelis[i]:=Tlabel.Create(form1);
with labelis[i] do begin
Caption:= 'Teritorija '+ inttostr(i);
Parent:=formos[i]; end;
inc(a);
end;
end;
Procedure TForm1.clickas(Sender: TObject);
begin
formos[r].show;
end;
procedure TForm1.FormActivate(Sender: TObject);
begin
for r:=1 to 4 do begin
img[r].OnClick:=clickas;
end;
end;
end.