![]() |
ImageList Problem bei for-Schleife
Ich habe mehrer Bilder und wenn man auf eins von den Bilder klickt, soll für das Bild ein anderes geladen werden. Dafür habe ich folgenden Source zusammen gestellt:
Delphi-Quellcode:
Nun habe ich das Problem, dass das Bild einfach nicht geladen wird ( FigurListe.GetBitmap(3, (findcomponent('Img'+inttostr(Bild)) as TImage).Picture.Bitmap) ). Setzte ich dafür zur Probe z.B. ein "Label1.Caprion := 'gehts?';" ein, funtzt es :gruebel: . Ich werde einfach nicht schlauer :hi:
procedure TForm1.imgBackroundMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var i, Bild : integer ; imgLeft , imgWidth, imgTop, imgHeight : integer ; begin if klick = true then begin Bild := 0 ; for i := 1 to 33 do begin imgLeft := (findcomponent('Img'+inttostr(i)) as TImage).Left ; imgWidth := (findcomponent('Img'+inttostr(i)) as TImage).Width ; imgTop := (findcomponent('Img'+inttostr(i)) as TImage).Top ; imgHeight := (findcomponent('Img'+inttostr(i)) as TImage).Height ; if (X >= imgLeft) and (X <= imgLeft+ImgWidth ) and (Y >= ImgTop ) and (Y <= ImgTop +ImgHeight) then Bild := i ; end; if Bild > 0 then // <-- PROBLEM !!!!!!!!! FigurListe.GetBitmap(3, (findcomponent('Img'+inttostr(Bild)) as TImage).Picture.Bitmap) ; end; end; |
Re: ImageList Problem bei for-Schleife
da muss mir doch jemand helfen können :warn:
Kommt schon, ein bisschen Hilfe :zwinker: |
Re: ImageList Problem bei for-Schleife
Zitat:
was mir nicht klar ist warum Du mit FindComponent arbeitest? Du möchtest doch nur das Bild auf das geklickt wurde durch ein anderes ersetzen. |
Re: ImageList Problem bei for-Schleife
Zitat:
![]() :duck: |
Re: ImageList Problem bei for-Schleife
jetzt strengt euch doch mal an :wall: :lol:
|
Re: ImageList Problem bei for-Schleife
habe mir den code mal angesehen
und nehme an, dass FigurListe von Typ TImageList ist und orgendwo vorher instanziert wird und mit bildchen geladen. was ist mit der globalen variablen klick? ich verstehe aber die intention von folgender zeile nicht Zitat:
|
Re: ImageList Problem bei for-Schleife
Alles richtig. Mit X und Y ist die Koordinate des Mausklicks gemeint :lol:
|
Re: ImageList Problem bei for-Schleife
Hi,
ein Bisserl OT: Zitat:
Delphi-Quellcode:
Vielleicht besser so... :wink:
...
if klick then ... |
Re: ImageList Problem bei for-Schleife
Klick hat nix damit zu tun.... :cry:
Das ist was anderes :mrgreen: |
Re: ImageList Problem bei for-Schleife
Ach mann :? weiß das wirklich keiner :cry:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 18:26 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz