TIcon and TImageList lazarus / 39-Graphics ---------------------------------------------------------------------- Dibo · 2009-05-24 11:00 Hi, I try to understand Lazarus graphic objects. How can I load icon to TIcon object from TImageList? Loading image to buttons glyphs is easy, but I can't do this on TIcon object. I tryed this: Code: [Select]procedure TMainForm.FormShow(Sender: TObject);  var   aBMP: TBitmap; begin   aBMP := TBitmap.Create;   try     imgListStatic16.GetBitmap(1, aBMP);     Self.Icon.LoadFromBitmapHandles(aBMP.BitmapHandle, aBMP.MaskHandle);   finally     aBMP.Free;   end; end; But it doesn't work. Greetings ---------------------------------------------------------------------- Paul Ishenin · 2009-05-25 22:32 You cannot load Icon from Bitmap handles. You can assign Bitmap to Icon. Icon.Assign(aBMP); ---------------------------------------------------------------------- Dibo · 2009-05-26 18:26 Thanks! ---------------------------------------------------------------------- rajivsoft · 2011-03-08 09:07 Hi, i need to switch the icon of TTrayIcon on timer event each second, now i'm using Tray_Main.Icon.LoadFromFile which i think is not very efficient done every second... So i'm trying to use TImageList but how i must do this with TBitmap.Create and then Tray_Main.Icon.Assign without going to have memory leaks? (what happens with old created TBitmap when i assign a new created TBitmap to my TTrayIcon?) or is there a more clear way to move? ---------------------------------------------------------------------- Dibo · 2011-03-08 10:59 TTryIcon have property Icons=TCustomImageList (not published so you can't see it in object inspector) and Animate and AnimateIntervals. Try use this on runtime