Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Delphi bild aus imagelist in Image (https://www.delphipraxis.net/92980-bild-aus-imagelist-image.html)

dajuhsa 29. Mai 2007 20:20


bild aus imagelist in Image
 
gut, ihr haltet mich jetzt warscheinlich für einen :stupid: volltrotel :oops: aber meine frage ist:

wie lädt man ein bild aus einer imagelist in ein image

hibbert 29. Mai 2007 20:33

Re: bild aus imagelist in Image
 
einfach mal die sufu benutzen ;)

[edit=Jelly] Mfg, Jelly[/edit]

dajuhsa 29. Mai 2007 20:43

Re: bild aus imagelist in Image
 
1. ich weiß, dass ich dumm bin.
2. Danke für die tolle antwort

DGL-luke 29. Mai 2007 20:48

Re: bild aus imagelist in Image
 
Ich würds mal per GetBitmap versuchen.

dajuhsa 29. Mai 2007 20:53

Re: bild aus imagelist in Image
 
hab schon mal n bisschen rumprobiert, aber ich hab dann immer probleme mit den typen TBitmap und TPicture

bitsetter 29. Mai 2007 20:59

Re: bild aus imagelist in Image
 
Hi,

Delphi-Quellcode:
imagelist1.GetBitmap(0,image1.Picture.Bitmap);

dajuhsa 29. Mai 2007 21:00

Re: bild aus imagelist in Image
 
Zitat:

Zitat von bitsetter
Hi,

Delphi-Quellcode:
imagelist1.GetBitmap(0,image1.Picture.Bitmap);

Danke Vielmals, ich hab wohl das Bitmap nach image1.picture vergessen

dajuhsa 29. Mai 2007 21:44

Re: bild aus imagelist in Image
 
ich hab jetzt noch ein problem:
Wenn in dem Image schon ein bild drin ist, dann lädt er kein neues mehr rein

bitsetter 29. Mai 2007 23:05

Re: bild aus imagelist in Image
 
Noch eine andere Möglichkeit:
Delphi-Quellcode:
var
  Bild: TBitmap;
begin
  Bild:= TBitmap.Create;
  try
    imagelist1.GetBitmap(0, Bild);
    image1.Picture.Bitmap.Assign(Bild);
  finally
    Bild.Free;
  end;
Das geht sogar auch, ist bestimmt nicht so gut.
Delphi-Quellcode:
 
  image1.Picture.Bitmap:= nil;
  imagelist1.GetBitmap(0, image1.Picture.Bitmap);

dajuhsa 30. Mai 2007 14:59

Re: bild aus imagelist in Image
 
Klappt super, vielmals danke :-D

dajuhsa 13. Jun 2007 19:53

Re: bild aus imagelist in Image
 
ich hab schon wieder ein problem...

Delphi-Quellcode:
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
var
BM: TBitmap;
begin
  if Key=#37 then begin
    BM := TBitmap.Create;
    try
      Imglist1.GetBitmap(1, BM);
      image1.Picture.Bitmap.Assign(BM);
    finally
      BM.Free;
    end;
  end;
  if Key=#38 then begin
    BM := TBitmap.Create;
    try
      Imglist1.GetBitmap(3, BM);
      image1.Picture.Bitmap.Assign(BM);
    finally
      BM.Free;
    end;
  end;
  if Key=#39 then begin
    BM := TBitmap.Create;
    try
      Imglist1.GetBitmap(2, BM);
      image1.Picture.Bitmap.Assign(BM);
    finally
      BM.Free;
    end;
  end;
  if Key=#40 then begin
    BM := TBitmap.Create;
    try
      Imglist1.GetBitmap(0, BM);
      image1.Picture.Bitmap.Assign(BM);
    finally
      BM.Free;
    end;
  end;
end;
funktioniert nicht, kein bild, keine reaktion... :wall:

Namenloser 13. Jun 2007 20:50

Re: bild aus imagelist in Image
 
Hi,

Zuerst einmal: Bist du sicher, dass das die richtigen Tastencodes sind? :zwinker:
Denn:
Code:
#37 = %
#38 = &
#39 = '
#40 = (
Evtl. hast du auch vergessen die Eigenschaft KeyPreview der Form auf true zu stellen.
Ansonsten sieht der Code nämlich richtig aus. :gruebel:

dajuhsa 13. Jun 2007 21:08

Re: bild aus imagelist in Image
 
ich hab mir mal ein programm geschrieben um mir die tastencodezahlen anzeigen zu lassen, da war alles richtig(a=65,b=66) und früher hat auch immer alles so geklappt, aber vllt. geht 37-40 nur bei KeyDown... , aber egal ich habs schön längst wieder hingekriegt :mrgreen:


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