AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

ImageList Problem bei for-Schleife

Ein Thema von LoW_FloW · begonnen am 6. Mär 2004 · letzter Beitrag vom 9. Mär 2004
Antwort Antwort
Seite 1 von 2  1 2      
Benutzerbild von LoW_FloW
LoW_FloW

Registriert seit: 29. Nov 2003
117 Beiträge
 
Delphi 7 Professional
 
#1

ImageList Problem bei for-Schleife

  Alt 6. Mär 2004, 10:44
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 . Ich werde einfach nicht schlauer
  Mit Zitat antworten Zitat
Benutzerbild von LoW_FloW
LoW_FloW

Registriert seit: 29. Nov 2003
117 Beiträge
 
Delphi 7 Professional
 
#2

Re: ImageList Problem bei for-Schleife

  Alt 7. Mär 2004, 16:41
da muss mir doch jemand helfen können
Kommt schon, ein bisschen Hilfe
  Mit Zitat antworten Zitat
Benutzerbild von Sharky
Sharky

Registriert seit: 29. Mai 2002
Ort: Frankfurt
8.251 Beiträge
 
Delphi 2006 Professional
 
#3

Re: ImageList Problem bei for-Schleife

  Alt 7. Mär 2004, 16:45
Zitat von LoW_FloW:
da muss mir doch jemand helfen können
Kommt schon, ein bisschen Hilfe
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.
Stephan B.
"Lasst den Gänsen ihre Füßchen"
  Mit Zitat antworten Zitat
Benutzerbild von LoW_FloW
LoW_FloW

Registriert seit: 29. Nov 2003
117 Beiträge
 
Delphi 7 Professional
 
#4

Re: ImageList Problem bei for-Schleife

  Alt 7. Mär 2004, 17:04
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
  Mit Zitat antworten Zitat
Benutzerbild von LoW_FloW
LoW_FloW

Registriert seit: 29. Nov 2003
117 Beiträge
 
Delphi 7 Professional
 
#5

Re: ImageList Problem bei for-Schleife

  Alt 8. Mär 2004, 20:30
jetzt strengt euch doch mal an
  Mit Zitat antworten Zitat
DelphiDeveloper

Registriert seit: 9. Apr 2003
Ort: Köln
256 Beiträge
 
Delphi XE2 Enterprise
 
#6

Re: ImageList Problem bei for-Schleife

  Alt 8. Mär 2004, 22:05
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;
  Mit Zitat antworten Zitat
Benutzerbild von LoW_FloW
LoW_FloW

Registriert seit: 29. Nov 2003
117 Beiträge
 
Delphi 7 Professional
 
#7

Re: ImageList Problem bei for-Schleife

  Alt 9. Mär 2004, 13:14
Alles richtig. Mit X und Y ist die Koordinate des Mausklicks gemeint
  Mit Zitat antworten Zitat
barnti

Registriert seit: 15. Aug 2003
Ort: Mal hier mal da...
689 Beiträge
 
Delphi 7 Enterprise
 
#8

Re: ImageList Problem bei for-Schleife

  Alt 9. Mär 2004, 13:19
Hi,

ein Bisserl OT:

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

Delphi-Quellcode:
...
if klick then
...
Vielleicht besser so...
Gruß,

Barnti
  Mit Zitat antworten Zitat
Benutzerbild von LoW_FloW
LoW_FloW

Registriert seit: 29. Nov 2003
117 Beiträge
 
Delphi 7 Professional
 
#9

Re: ImageList Problem bei for-Schleife

  Alt 9. Mär 2004, 14:03
Klick hat nix damit zu tun....
Das ist was anderes
  Mit Zitat antworten Zitat
Benutzerbild von LoW_FloW
LoW_FloW

Registriert seit: 29. Nov 2003
117 Beiträge
 
Delphi 7 Professional
 
#10

Re: ImageList Problem bei for-Schleife

  Alt 9. Mär 2004, 17:34
Ach mann weiß das wirklich keiner
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 1 von 2  1 2      


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:24 Uhr.
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