trollnumber1
Messages postés12Date d'inscriptionlundi 17 février 2003StatutMembreDernière intervention28 avril 2003
-
29 mars 2003 à 01:09
cs_Delphiprog
Messages postés4297Date d'inscriptionsamedi 19 janvier 2002StatutMembreDernière intervention 9 janvier 2013
-
29 mars 2003 à 09:36
Troll 8-)
j'ai plusieur Timage ex: image1 ,image2 jusqua 260
je veux savoir comment on fait pour remplacer le chiffre par une variable pour que je puise aller dans l'image que je veux.
ex:
var
img: integer;
begin
Img:=0;
repeat
inc(Img);
begin
if source=Image(Img) then //C la que j'ai de la misère
begin
end;
end;
until img:=220;
end;
c'est pour pas etre oubliger de mettre if source=image1 then
ansi de suite jusqua if source=image220 then
cs_Delphiprog
Messages postés4297Date d'inscriptionsamedi 19 janvier 2002StatutMembreDernière intervention 9 janvier 201332 29 mars 2003 à 09:36
Proposition : utiliser la méthode FindComponent.
procedure TForm1.Button1Click(Sender: TObject);
var
AComponent : TComponent;
i: integer;
begin
for i:= 0 to ComponentCount - 1 do
begin
//Recherche des composants dont le nom commence par 'image'
Acomponent := FindComponent('Image'+IntToStr(i));
if AComponent <> nil then
//par sécurité, vérification du type
if AComponent is TImage then
with AComponent as TImage do
begin
//Ton traitement
end;
end;
end;