Gif And Splash Screen

Simcoder

Centurion
Joined
Apr 18, 2003
Messages
125
Location
South Carolina
Hey all, I have a quick question about setting up a Splash Screen for my application. I created a Gif File that I want to use on my Splash screen. Only problem is this, the Gif file will continually animate even after the first time. Since this is a Splash Screen, this is not what I want to happen. Is there any way to set my Gif file to only animate once on the picturebox. Any solutions and/or suggestions would be greatly appreciated.

Thanks in advance,

-=Simcoder=-
 
Yes. A GIF file specifies how long to show each frame and how many times to cycle through the animation. If you are the author of the GIF, search your program for these settings. If not then you might be able to open the GIF in a program such as ImageReady or a GIF editor and change these settings, provided that this does not infringe upon any copyright or license.
 
Thanks marble beater. You forgot to mention a large number of other features in a good GIF animator program...but I didn't think it was necessary to respond to this simple question in such an arrogant manner.
 
Thanks for the replys fellas, but unfortunately, that will not work. I'm using Jasc Animation Shop 3 and I made my Gif file loop only once. It works fine when I open it up inside of Internet Explorer but when you put a gif inside of a picturebox control, it still continues to Loop it. Any other suggestions?

-=Simcoder=-
 
I opened up System.Windows.Forms with Reflector to see how it implemented things. It uses an ImageAnimator internally to animate the GIF. As far as I could tell from 5 minutes of poking around (I LOVE Reflector), the ImageAnimator just handles looping through frames in an animation - it doesn't check whether or not looping is turned on or anything else. I don't know much about the ImageAnimator class, but I saw this blog that had some sample code to manually animate a GIF. If it's that important, maybe there's something in there that will help.

It's also possible that the PictureBox has an event you could use. Or, worse case, make your own animator using the code from the blog above. You'd only have to do it once and it would be yours forever! :)

-ner
 
DiverDan said:
Thanks marble beater. You forgot to mention a large number of other features in a good GIF animator program...but I didn't think it was necessary to respond to this simple question in such an arrogant manner.
Dictionary.com said:
ar·ro·gant
adj.

1. Having or displaying a sense of overbearing self-worth or self-importance.
I completely fail to understand. I didn't realize that I was doing anything more than giving helpful information. I was elaborating on the information provided. If you were intentionally providing little information or you were being sarcastic, I didn't catch on (because I assume that people answer questions with a better attitude than that).

Here is a suggestion (I hope this doesn't offend anyone): If the PictureBox loops continually regardless of the settings of a GIF, you could try to set the last frame to a really long time to basically achieve the effect of looping though once.

Oh, and DiverDan, thats a great pun, there, "marble beater". I'll be laughing for days. Or something.
 
Thanks for the replies everyone. I wanted to make this as little complicated as I could. Setting the last frame of the gif would have worked. I decided it would probably be just as easy to just save each individual frame in the gif to a jpeg or something and use a timer to loop through them.

-=Simcoder=-
 
I was just about to reply and suggest you can set the last image to wait 999 seconds until the next frame. If you're app takes longer than that to load you have bigger problems :P
 
On setting the last frame to wait a really long time --

I have noticed that GIFs are rendered and shown differently in different situations. A quick story for you, a really pretty animated GIF I made that had like a .5 sec dely between images for a slow moving effect looked great on my machine(WinXP, OfficeXP) but was completely ignored by the machine I was giving the presentation on(Win2000, Office2000). So, my awesome gif went chunky the first time through until everything loaded, and then blazed stupidly in a continuous loop while I was presenting in front of 15-20 people.

Anyway, I'm not sure if .Net would do the rendering or if it eventually goes down to a kernal call and that's the reason I'm bringing this up. What may happen is that your 999 second delay is ignored on some systems and the GIF loops anyway in rapid succesion.
 
Yes, inconsistancy with regard to the settings in the GIF (in our case, the number of times to loop) is exactly why I recommended using a very long last frame, but you certainly raised a good point. I suppose the best approach would be to animate it yourself, either through existing .Net classes, or simply by displaying a series of images. The latter concerns me, though. I am afraid that you will get a "tearing" effect.
 
Just a thought. What if i just made a Windows Avi file or Wmv file and played that somehow. Would that work? Is it a good idea? And if it is a good idea, How would I accomplish this?

-=Simcoder=-
 
Simcoder said:
Just a thought. What if i just made a Windows Avi file or Wmv file and played that somehow. Would that work? Is it a good idea? And if it is a good idea, How would I accomplish this?

-=Simcoder=-
If you use a movie file, AVI will be your best bet. I once had a freeware program that could create animated gifs/avis. You might be able to use Windows Media Player, or something similar. Be careful, though, a splash screen is not the meat of your program and you needn't over do it. And just because there are ways to create irregularly shaped or alpha-blended or animated splashscreens doesn't mean that there is no such thing as a rectangular, static splash screen that looks nice and proffessional.
 
Back
Top