Autor Beitrag
redbird
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38

Win XP, Vista Business (64bit), Win 7 Prof. (64bit)
Delphi 7, Java, PHP
BeitragVerfasst: Mi 21.12.05 20:31 
Hallo,
habe ein klitzekleines Problem mit der Anzeige eines Bildes.

In Bild 1 (TImage Kompo) ist schon ein Bild geladen (über Picture), in Bild 2 ist kein Bild definiert.

Nun soll bei einem Klick auf Bild 1 das gleiche Bild, das schon in Bild 1 existiert, auch in Bild 2 angezeigt werden (voriges Bild in Bild2 soll gelöscht werden). Das OnClick-Ereignis sollte weiterhin unabhängig vom Namen des ageklickten Bildes sein, da das Ereignis für mehrere Bilder definiert ist.

Mir fehlt es an Wissen, was das Laden des einen Bildes in das andere anbelangt (und die Definition das Image2.Picture:=Image1.Picture ist, funktioniert nicht (kein Fehler, Bild wird nur nicht angezeigt).

Vielen Dank für eure Hilfe
Gruß redbird


Zuletzt bearbeitet von redbird am Mi 21.12.05 20:53, insgesamt 1-mal bearbeitet
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Mi 21.12.05 20:45 
Probiers mal andersherum...
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Image1Click(Sender: TObject);
begin
 Image2.Picture:=Image1.Picture;
end;
redbird Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38

Win XP, Vista Business (64bit), Win 7 Prof. (64bit)
Delphi 7, Java, PHP
BeitragVerfasst: Mi 21.12.05 20:52 
Möp, sorry die Reihenfolge im Code stimmt bei mir schon, hatte es nur eben bei dem Beitrag umgedreht. Der Code sieht momentan so aus (für das OnClick-Ereignis bei TImage1):

ausblenden Delphi-Quelltext
1:
Im_rbdesc.Picture:=TImage(Sender).Picture;					


Im_rbdesc ist die TImage-Kompo in der das angeklickte Bild angezeigt werden soll.
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Mi 21.12.05 21:31 
Ich glaub Ich versteh dein Problem nicht so richtig...

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TForm1.Image1Click(Sender: TObject);
begin
  Im_rbdesc.Picture:=TImage(Sender).Picture;
end;

procedure TForm1.Image2Click(Sender: TObject);
begin
  Im_rbdesc.Picture:=TImage(Sender).Picture;
end;

procedure TForm1.Image3Click(Sender: TObject);
begin
  Im_rbdesc.Picture:=TImage(Sender).Picture;
end;
redbird Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38

Win XP, Vista Business (64bit), Win 7 Prof. (64bit)
Delphi 7, Java, PHP
BeitragVerfasst: Mi 21.12.05 21:55 
Mein Problem liegt daran, dass eben jener Algorithmus nicht funktioniert, sprich dieses Bild nicht durch obige Definition im anderen Image angezeigt wird. Entweder liegt der Fehler an meinen etwas modifizierten Komponenten oder schlichtweg daran, dass es einem anderen Algorithmus bedarf.
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Do 22.12.05 09:06 
Ich habs getestet am Code liegts nicht, bei Mir funktionierts.
Und wenn das nicht funktioniert Image2.Picture:=Image1.Picture, was ja ansich dasselbe ist wirds wohl an deiner Modifizierung liegen denk Ich mal.
Vieleicht hat ja noch jemand anders ne' Idee.
chrisw
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 439
Erhaltene Danke: 3

W2K
D7
BeitragVerfasst: Do 22.12.05 10:07 
Hm, sollte eigentlich so funktionieren !

Ich würde allerdings Assign() benutzen !

ausblenden Delphi-Quelltext
1:
Im_rbdesc.Picture.Assign(TImage(Sender).Picture);					

_________________
Man sollte keine Dummheit zweimal begehen, die Auswahl ist schließlich groß genug.
redbird Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38

Win XP, Vista Business (64bit), Win 7 Prof. (64bit)
Delphi 7, Java, PHP
BeitragVerfasst: Do 22.12.05 13:34 
OK, danke für eure Hilfe. Sobald sich die Möglichkeit ergibt, werde ich diese Methode erproben.