Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi ImageList Problem bei for-Schleife (https://www.delphipraxis.net/17470-imagelist-problem-bei-schleife.html)

LoW_FloW 6. Mär 2004 10:44


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:
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;
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:

LoW_FloW 7. Mär 2004 16:41

Re: ImageList Problem bei for-Schleife
 
da muss mir doch jemand helfen können :warn:
Kommt schon, ein bisschen Hilfe :zwinker:

Sharky 7. Mär 2004 16:45

Re: ImageList Problem bei for-Schleife
 
Zitat:

Zitat von LoW_FloW
da muss mir doch jemand helfen können :warn:
Kommt schon, ein bisschen Hilfe :zwinker:

Hai Low_Flow,

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.

LoW_FloW 7. Mär 2004 17:04

Re: ImageList Problem bei for-Schleife
 
Zitat:

Zitat von Sharky
was mir nicht klar ist warum Du mit FindComponent arbeitest?

Ohne FindComponent habe ich das nicht hinbekommen: http://www.delphipraxis.net/internal...ct.php?t=19240
:duck:

LoW_FloW 8. Mär 2004 20:30

Re: ImageList Problem bei for-Schleife
 
jetzt strengt euch doch mal an :wall: :lol:

DelphiDeveloper 8. Mär 2004 22:05

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:

if (X >= imgLeft) and (X <= imgLeft + ImgWidth) and
(Y >= ImgTop) and (Y <= ImgTop + ImgHeight) then
Bild := i;

LoW_FloW 9. Mär 2004 13:14

Re: ImageList Problem bei for-Schleife
 
Alles richtig. Mit X und Y ist die Koordinate des Mausklicks gemeint :lol:

barnti 9. Mär 2004 13:19

Re: ImageList Problem bei for-Schleife
 
Hi,

ein Bisserl OT:

Zitat:

...
if klick = true then
...
'Räusper' :pale:

Delphi-Quellcode:
...
if klick then
...
Vielleicht besser so... :wink:

LoW_FloW 9. Mär 2004 14:03

Re: ImageList Problem bei for-Schleife
 
Klick hat nix damit zu tun.... :cry:
Das ist was anderes :mrgreen:

LoW_FloW 9. Mär 2004 17:34

Re: ImageList Problem bei for-Schleife
 
Ach mann :? weiß das wirklich keiner :cry:


Alle Zeitangaben in WEZ +1. Es ist jetzt 23:41 Uhr.
Seite 1 von 2  1 2      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz