unit UFang1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TFPanel1 =
class(TForm)
BStart: TButton;
ShSpiel: TShape;
Panel: TPanel;
Timer1: TTimer;
procedure BStartClick(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure PanelWeg(Sender:TObject);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
FPanel1: TFPanel1;
implementation
uses UPunkte;
{$R *.dfm}
procedure TFPanel1.BStartClick(Sender: TObject);
var i: integer;
begin
for i:= 0
to 4
do begin
Panel:= TPanel.Create (ShSpiel);
Panel.Color:= clYellow;
Panel.Caption:= '
F';
Panel.Width:= 49;
Panel.Height:= 33;
Panel.Left:= Random(ShSpiel.Width-60)+30;
Panel.Top:= Random(ShSpiel.Height-50)+30;
Panel.Parent:= FPanel1;
Panel.OnClick:= PanelWeg;
end;
//FPunkte:=TFPunkte.Create(self);
//FPunkte.showModal;
end;
procedure TFPanel1.FormCreate(Sender: TObject);
begin
randomize;
end;
procedure TFPanel1.Timer1Timer(Sender: TObject);
var i: integer;
begin
Timer1.Enabled:= True;
for i:=0
to ComponentCount-1
do begin
if Components[i]
is TFPanel1
then begin
TFPanel1(Components[i]).Left:= Random(ShSpiel.Width-25);
TFPanel1(Components[i]).Top:= Random(ShSpiel.Height-25);
end;
end;
end;
procedure TFPanel1.PanelWeg(Sender:TObject);
begin
TPanel(Sender).Hide;
end;
end.