UCM Posted January 7, 2003 Posted January 7, 2003 How do you play an animated gif in .NET... Like on a form, panel, button, toolbar, label, or picturebox ( i'd rather not use a picturebox if possible ) Quote UCM >-)
*Experts* Nerseus Posted January 7, 2003 *Experts* Posted January 7, 2003 I don't believe there's any built-in support for showing the animation part of an animated gif. You can load an animated gif as a single image but to use the other images as an animation will require parsing the gif yourself or using a 3rd party control. Or, you could use the WebBrowser control :p -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
UCM Posted January 8, 2003 Author Posted January 8, 2003 lol, I know about the AXWebBrower control... This is a very nifty control indeed.... but the thing is that I dont want to 'have' to use it to achieve an animated gif.... Your idea of parsing the images out of the gif sounds rock on... Does anyone have any ideas on how I could retrieve the multiple images stored in a gif? Or even retrieve the animated gif info ( looping, first image, transparent color, ect ) Quote UCM >-)
*Experts* Nerseus Posted January 8, 2003 *Experts* Posted January 8, 2003 Here's a link to a post on another forum that has VB6 code to parse an animated gif and display it with transparency. I think he got the code from someone else and ported it to VB6 (or for his own needs). Regardless, it works and could get you started. Click here to download. -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
*Gurus* divil Posted January 8, 2003 *Gurus* Posted January 8, 2003 This is very possible with just the .NET framework. It has full support for reading images with multiple frames in. I knocked up some code to get all the frames and their display times, but then came across the following URL where they seem to have wrapped everything nicely to run animated gifs in a ThreadPool. The ImageAnimator class in the System.Drawing namespace is what you need. http://www.c-sharpcorner.com/Code/2002/Nov/ThreadPoolGifs.asp Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
*Experts* Nerseus Posted January 8, 2003 *Experts* Posted January 8, 2003 Rock on :) -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
UCM Posted January 9, 2003 Author Posted January 9, 2003 Nice c# examples, Divil...Is there a quick VB translation? Quote UCM >-)
*Gurus* divil Posted January 9, 2003 *Gurus* Posted January 9, 2003 Not if there wasn't one on the site. I believe there are some free web C# to VB translators out there though, could be worth searching. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.