Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Icon aus Resource in eine Imagelist? (https://www.delphipraxis.net/28256-icon-aus-resource-eine-imagelist.html)

Pseudemys Nelsoni 22. Aug 2004 02:45


Icon aus Resource in eine Imagelist?
 
siehe topic,

wie mache ich das?

hatte es schon hiermit versucht:

Delphi-Quellcode:
imagelist1.ResourceLoad(restype, 'ICO_READ_CD', clRed);
geht aber nicht :\

Niko 22. Aug 2004 16:03

Re: Icon aus Resource in eine Imagelist?
 
Hi,

das sollte so funktionieren:
Delphi-Quellcode:
ImageList1.GetResource(rtIcon, 'ICO_READ_CD', 0, lrNone, clRed);

Pseudemys Nelsoni 22. Aug 2004 16:17

Re: Icon aus Resource in eine Imagelist?
 
hallo, leider geht es nicht :(

die imagelist ist immernoch leer, denn:

Delphi-Quellcode:
imagelist1.GetIcon(0, image1.Picture.Icon);
funktionietr nicht(weil kein bild da) :(

Niko 23. Aug 2004 17:06

Re: Icon aus Resource in eine Imagelist?
 
Hm, komisch.

Aber wenn's mit den Borland-Funktionen nicht geht, dann eben ganz altmodisch über die Win-API :wink: :
Delphi-Quellcode:
var
  Hd: THandle;
  Ico: TIcon;

//...

Hd := LoadImage(HInstance, 'MAINICON', IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
Ico := TIcon.Create;
try
  Ico.ReleaseHandle;
  Ico.Handle := Hd;
  ImageList1.AddIcon(Ico);
finally
   Ico.Free;
end;


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