Einzelnen Beitrag anzeigen

Benutzerbild von Nalincah
Nalincah

Registriert seit: 18. Jul 2003
898 Beiträge
 
Delphi 6 Professional
 
#8

Re: schnelles Anzeigen von SpeedButtons

  Alt 24. Sep 2003, 07:59
Versuch doch mal den Quelltext

Delphi-Quellcode:
procedure TForm2.FormCreate(Sender: TObject);
begin
  LoadGrafik(SpeedButton1);
  LoadGrafik(SpeedButton2);
  LoadGrafik(SpeedButton3);
  LoadGrafik(SpeedButton4);
  LoadGrafik(SpeedButton5);
  LoadGrafik(SpeedButton6);
  LoadGrafik(SpeedButton7);
  LoadGrafik(SpeedButton8);
  LoadGrafik(SpeedButton9);
  LoadGrafik(SpeedButton10);
  LoadGrafik(SpeedButton11);
  LoadGrafik(SpeedButton12);
  LoadGrafik(SpeedButton13);
  LoadGrafik(SpeedButton14);
  LoadGrafik(SpeedButton15);
  LoadGrafik(SpeedButton16);
  LoadGrafik(SpeedButton17);
  LoadGrafik(SpeedButton18);
  LoadGrafik(SpeedButton19);
  LoadGrafik(SpeedButton20);
  LoadGrafik(SpeedButton21);
  LoadGrafik(SpeedButton22);
  LoadGrafik(SpeedButton23);
  LoadGrafik(SpeedButton24);
end;
So umzuschreiben:

Delphi-Quellcode:
procedure TForm2.FormCreate(Sender: TObject);
var
  i : integer;
begin
  for i := 1 to 24 do
  begin
    LoadGrafik(Form2.FindComponent('Speedbutton' + i);
  end;
end;
Sebastian
Ehemals bekannt als General2004
  Mit Zitat antworten Zitat