I want to know how is it possible to animate gif image that is put in TImageList.
I know that if we could access the graphic of each images in TImageList it may be possible cast the graphic of the picture to TGIFImage and set Animate property to true. but the problem is how can we access the image that is loaded in TImageList and cast it to TGIFImage and set that animate property?
EDIT:
How we can have animated gif in TTreeView?
As David Heffernan answered TImageList is not appropriate for saving gif images. but the purpose of this question was to have an animated gif in a treeview. By the suggestion of Remy-lebeau I wrote a unit for that. In this unit I defined two classes. first TGifImageRefrence that uses a TImagelist as its property and must be assigned and has a procedure that add gif image to this imagelist. each frame will be saved as single image in Imagelist and frames' indexes and animationspeed will be saved. The Second class is TGifNode that its purpose is to be a node in TreeView. It contains a timer an accept a TGifImageRefrence as it's property. you can inherit a class for your own node for your treeview from this class. I write an example using this unit and put them together and you can download it from http://loghman.ir/MySource/GifInTreeView.zip
A TImageList
stores a list of equally sized static images. It's not appropriate for hosting an animated GIF. You could unpack all the images from the animated GIF and put them in the images list. And then reconstruct them later for animation. That would seem pointless. You should use TGIFImage
for animating a GIF.