Autor Beitrag
110022
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 287

XP SP2
Delphi 7
BeitragVerfasst: So 02.12.07 15:10 
und was ist hier dran falsch?
ausblenden Delphi-Quelltext
1:
2:
3:
procedure TForm1.Timer3Timer(Sender: TObject);
begin
if image1.Picture:='image\haken ein.jpg' then timer4.enabled:=true;


diese Meldung kommt:
ausblenden Delphi-Quelltext
1:
[Fehler] Unit1.pas(71): Inkompatible Typen: 'String' und 'TPicture'					


Zuletzt bearbeitet von 110022 am So 02.12.07 15:32, insgesamt 2-mal bearbeitet
PeterPain
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 83



BeitragVerfasst: So 02.12.07 15:17 
Eigentlich hast du deine Frage selber beantwortet!

Das Objekt enthält ja keinen String, sondern die Bilddaten, deswegen ist der vergleich unsinnig. Du kannst entweder jedesmall wenn du ein neues bild lädst den Pfad zur Datei speichern und dann damit vergleichen, oder das neue Bild erstmal laden und dann mit dem alten vergleichen, was deutlich schwieriger sein dürfte.
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: So 02.12.07 15:27 
Benutze die Tag-Eigenschaft:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
if Image1.Tag = 0 then
  begin
    image1.piture.loadfromfile('C:\haken-an.bmp');
    image1.tag := 1;
  end
else
  begin
    image1.piture.loadfromfile('C:\haken-aus.bmp');
    image1.tag := 0;
  end;