Delphi-PRAXiS

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 TImageList gibt TImage Bild, Bild wechselt aber nicht (https://www.delphipraxis.net/134533-timagelist-gibt-timage-bild-bild-wechselt-aber-nicht.html)

Super_Chemiker 24. Mai 2009 11:34


TImageList gibt TImage Bild, Bild wechselt aber nicht
 
Hallo DP,
ich habe ein Problem:
Ich will einem TImage, ein Bild aus einer Imagelist zuweisen, das Bild soll aber während die Anwendung gestartet ist auf Knopfdruck wechseln.
Leider funktioniert das weder mit ImageList.Draw, noch mit ImageList.GetImage

Danke schonmal für eure Hilfe
mfG

mkinzler 24. Mai 2009 11:35

Re: TImageList gibt TImage Bild, Bild wechselt aber nicht
 
Zeig mal deinen Code

Super_Chemiker 24. Mai 2009 11:47

Re: TImageList gibt TImage Bild, Bild wechselt aber nicht
 
Delphi-Quellcode:
procedure TForm1.WurfClick(Sender: TObject);
begin
  randomize;
  W1 := random(5);
  W2 := random(5);
  if W1>W2 then
  begin
    WL.Draw(WB1.Canvas, 0, 0, W1);
    WL.Draw(WB2.Canvas, 0, 0, W2);
  end
  else
  begin
    WL.Draw(WB1.Canvas, 0, 0, W2);
    WL.Draw(WB2.Canvas, 0, 0, W1);
  end;
  Wurf.Enabled := true;
end;
bzw. dasselbe mit GetImage...

toms 24. Mai 2009 11:49

Re: TImageList gibt TImage Bild, Bild wechselt aber nicht
 
Delphi-Quellcode:
 Image1.Picture.Bitmap := nil;
 ImageList1.GetBitmap(ImageIdx, Image1.Picture.Bitmap);

Super_Chemiker 24. Mai 2009 11:51

Re: TImageList gibt TImage Bild, Bild wechselt aber nicht
 
Danke Herr Codelib Manager jetzt gehts!!!
Und danke auch an den Moderator!!!
An dem Problemchen knabber ich nämlich schon lange!

SimStar001 24. Mai 2009 11:53

Re: TImageList gibt TImage Bild, Bild wechselt aber nicht
 
Delphi-Quellcode:

var Bitmap : TBitmap;
...
  imagelist1.GetBitmap(0,Bitmap)
  image1.Picture.Assign(Bitmap);


Alle Zeitangaben in WEZ +1. Es ist jetzt 16:03 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