procedure TForm1.Timer1Timer(Sender: TObject);
begin
if ind<35 then Inc(ind) else ind:=0;
if ind=0 then image2.Visible:=true;
if ind=1 then image3.Visible:=true;
if ind=2 then image4.Visible:=true;
if ind=3 then image5.Visible:=true;
if ind=4 then image6.Visible:=true;
if ind=5 then image7.Visible:=true;
if ind=6 then image8.Visible:=true;
......
if ind=35 then image24.Visible:=true;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if ind<35 then Inc(ind) else ind:=0;
case ind of
0: image2.Visible:=true;
1: image3.Visible:=true;
2: image4.Visible:=true;
// ...
35: image24.Visible:=true;
end;
end; { Timer1Timer }
1: image43.Visible:=true and image42.Visible:=false;Это нужно для осуществления циклической анимации, вроде стрелки часов
1:
begin
image42.Visible:=false; image43.Visible:=true;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
ImageArray[ind].Visible := False; // Гасим то, изображение, которое было активным
ind := (ind + 1) mod 35; // аналог if ind<35 then Inc(ind) else ind:=0;
ImageArray[ind].Visible := True; // Показываем следующее изображение
end;
type
TForm1 = class(TForm)
// ...
Image1: TImage;
Image2: TImage;
Image3: TImage; // Для теста сделал всего 3 изображения
private
{ Private declarations }
public
ImageArray: array[0 .. 2] of TImage; // Место под массив изображений
// ...
end;
// При инициализации формы - заполняем массив:
procedure TForm1.FormCreate(Sender: TObject);
var i: integer;
begin
for i := 0 to 2 do
begin
ImageArray[i] := FindComponent(Format('Image%d', [i + 1])) as TImage;
end;
// ...
end;
a:array [1..10] of TImage;Опаздал
...
procedure TForm3.Button1Click(Sender: TObject);
var
i,k:integer;
begin
k:=0;
for i := 0 to ComponentCount - 1 do begin
if (Components[i] is TImage) then begin
inc(k);
a[k] := Components[i] as TImage;
end;
end;
end;
ImageArray[i] := FindComponent(Format('Image%d', [i + 1])) as TImage;
мой_массив[111].свойствоа не
Image111.свойствоЕсли не подходит сделать так, то замени условные на case и все
const
Timer1_Count = 21;
Timer1_IDs: array[1 .. Timer1_Count] of Integer = (
112,
245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
255, 256, 257, 258, 259, 260, 261, 262, 263, 264
);
var
T1_ImageArray: array[1 .. Timer1_Count] of TImage;
// Заполнять массив Image-й для этого таймера - вот так:
for i := 1 to Timer1_Count do begin
T1_ImageArray[i] := FindComponent(Format('Image%d', [ Timer1_IDs[i] ])) as TImage;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if ind<35 then Inc(ind) else ind:=0;
if ind=0 then image2.Visible:=true;
if ind=1 then image3.Visible:=true;
if ind=2 then image4.Visible:=true;
if ind=3 then image5.Visible:=true;
if ind=4 then image6.Visible:=true;
if ind=5 then image7.Visible:=true;
if ind=6 then image8.Visible:=true;
......
if ind=35 then image24.Visible:=true;
end;
if ind<35 then Inc(ind) else ind:=0;Ну, для каждого таймера сделать проверку на границы, и все.
my_array[ind+2].visible := true;