Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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 )

UCM

>-)

  • *Experts*
Posted

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

"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
Posted

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 )

UCM

>-)

  • *Experts*
Posted

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

"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*
Posted

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

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*
Posted

Rock on :)

 

-Nerseus

"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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...