Einzelnen Beitrag anzeigen

Benutzerbild von DGL-luke
DGL-luke

Registriert seit: 1. Apr 2005
Ort: Bad Tölz
4.149 Beiträge
 
Delphi 2006 Professional
 
#7

Re: listbox und fensterwechsel

  Alt 10. Feb 2007, 18:17
Delphi-Quellcode:
type
  TDataRecord = record
    Image: string;
    Text: string;
  end;

var
  Data: array of TDataRecord;

procedure TForm1.Listbox1CLick(Sender: TObject);
begin
  if Listbox1.ItemIndex > -1 then //wenn nichts ausgewählt ist, kannst du nicht laden
  begin
    Image1.Bitmap.LoadFromFile(Data[Listbox1.ItemIndex].Image);
    Label1.Caption := Data[Listbox1.ItemIndex].Text;
  end;
end;
Dabei ist jetzt noch nicht eingerechnet, dass du ja zusätzlich noch ein Menü haben willst.
Lukas Erlacher
Suche Grafiktablett. Spenden/Gebrauchtangebote willkommen.
Gotteskrieger gesucht!
For it is the chief characteristic of the religion of science that it works. - Isaac Asimov, Foundation I, Buch 1