OK, der Fehler ist behoben.
(Sender.Controls[0] würde überarbeitet)
Delphi-Quellcode:
Procedure TForm1.dynPanelOnClick(Sender: TObject);
Begin
With (Sender as TPanel) do Begin
zug := (Sender as TPanel).Name;
If merker = 0 Then Begin
name1 := (Sender as TPanel).Name;
tag1 := (Sender as TPanel).Tag;
{Imagename1 := TImage(TPanel(Sender).Controls[0]).Name;}
Imagename1 := ((Sender as TPanel).Controls[0] as TImage).Name;
merker := 1;
End;
If zug <> name1 Then Begin
(Sender as TPanel).Visible := true;
name2 := (Sender as TPanel).Name;
tag2 := (Sender as TPanel).Tag;
{Imagename2 := TImage(TPanel(Sender).Controls[0]).Name;}
Imagename2 := ((Sender as TPanel).Controls[0] as TImage).Name;
merker := 0;
End;
Label1.Caption := name1;
Label2.Caption := IntToStr(tag1);
Label3.Caption := name2;
Label4.Caption := IntToStr(tag2);
End;
End;