Comment créer un composant à l'exécution
procedure TForm1.Button1Click(Sender: TObject);
var
Button: TButton;
begin
Button:=TButton.Create(Form1);
try
with Button do
begin
Parent:=Self;
Left:=Random(Form1.ClientWidth-Width);
Top:=Random(Form1.ClientHeight-Height);
Caption:='Button';
end;
except
Button.Free;
end;
end;
Commentaires
Enregistrer un commentaire