![]() |
Re: Bilder aus ImageList auswählen
hab in der combobox erstmal von 0-10 Tstrings erstellt
in der imagelist sind 57 Bilder (die später über ihre namen in der ComboBox auswählbar sind)mach ich aber später also wenn ich jetzt in der combobox 1 auswähle wird bild 2 angezeigt wähle ich jetzt die 2 bleibt bild 2 aber bestehen
Delphi-Quellcode:
unit Unit2;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ImgList, StdCtrls, ExtCtrls; type TForm2 = class(TForm) Image1: TImage; ComboBox1: TComboBox; ImageList1: TImageList; procedure ComboBox1Change(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form2: TForm2; implementation {$R *.dfm} procedure getimage(imglst:TimageList; Id:Integer;bitmap:tbitmap); var bit : TBitmap; begin bit := TBitmap.Create; try imglst.GetBitmap(id, Bit); bitmap.Assign(bit); finally FreeAndNil(Bit); end; end; procedure TForm2.ComboBox1Change(Sender: TObject); var bitmap : tbitmap; begin bitmap := tbitmap.create; getimage(ImageList1,0,bitmap); Image1.picture.bitmap.assign(bitmap); freeandnil(bitmap); end; end. |
Re: Bilder aus ImageList auswählen
Zitat:
Richtig wäre:
Delphi-Quellcode:
Ntürlich ist das sehr code spezifisch aber bei denem sollte es so wie ich es verstanden habe gehen ...
procedure TForm2.ComboBox1Change(Sender: TObject);
var bitmap : tbitmap; begin bitmap := tbitmap.create; getimage(ImageList1,combobox1.itemindex,bitmap); Image1.picture.bitmap.assign(bitmap); freeandnil(bitmap); end; end.
Delphi-Quellcode:
das musst du ändern
getimage(ImageList1,combobox1.itemindex,bitmap);
|
Re: Bilder aus ImageList auswählen
ganau so jetzt klappt es
konnte über einzelne buttons auch unterschiedliche bilder anzeigen war mir also schonmal klar das es an der combo box lag Danke nochmal!! Hast du Nachtschicht im Forum? Bereitschaftsdienst? |
Re: Bilder aus ImageList auswählen
Nein Langeweile ^^
|
Re: Bilder aus ImageList auswählen
Und wie bekomm ich Jpeg´s in die imagelist die BMP´s blähen das prog so auf
mit jpeg unter uses brigts nichts oder brauch ich was anderes |
Re: Bilder aus ImageList auswählen
Vielleicht magst Du dir den Thread hier anschauen ->
![]() Grüße Klaus |
Re: Bilder aus ImageList auswählen
Gibts auch was wo ich für die antwort nicht 10 Dollar hinlegen muss
|
Re: Bilder aus ImageList auswählen
Hallo,
warum so kompliziert? :cyclops: Bei mir funktioniert es auch so (für Bitmaps):
Delphi-Quellcode:
ohne umständliche Funktion.
ImageList1.GetBitmap(ComboBox1.ItemIndex, Image1.Picture.Bitmap);
// auch wieder in ComboBox.onChange Das Erneuern klappt bei mir mit
Delphi-Quellcode:
Für Jpeg-Bilder kann ich dir übrigens die
Image1.Refresh;
![]() Gruß, ManuMF |
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:16 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 by Thomas Breitkreuz