.Net and animated GIFs in Windows forms

Apparently when you use an animated GIF as a background image in a control (e.g. button or picturebox), the image lacks animation, i.e. it just sits there with its starting layer.  This is kind of annoying, but I was able to work around it in this particular instance by using PictureBox.Image.  I suppose if I were really desperate I could have used Thread.Sleep with a bunch of different images on rotation to make it look like an animated GIF.

Print | posted on Monday, December 18, 2006 10:32 PM

Comments on this post

# worse with imagelist

Requesting Gravatar...
Thanks for this post. As basic as it is- it helped me out. I've noticed this behavior to, and couldn't figure out why my animation wasn't working. I had specified the gif in the image property of the picbox. In my constructor for my class, though, I was resetting the image property to an index of the imagelist (which contained the animated gif). Removing the line in the constructor brought the animation back.

So apparently- you can't store an animated gif in an imagelist.

Thanks again- you pointed me in the right direction!
Left by Willy on Mar 30, 2008 9:31 AM

Your comment:

 (will show your gravatar)
 
Please add 5 and 6 and type the answer here: