C# swap between two images (gif?)

Man of Honour
Joined
18 Oct 2002
Posts
13,262
Location
Northallerton/Harrogate
Hi,

Haven't looked on t'Internet yet, just doing so.
Basically, I want to make a little "light" flash on and off on my application's UI. I can do it with a timer of course, to change the colour of some coloured rectangle or something like that...

But is it really necessary.
Could I say, make a gif with two frames and use some in-built .net wizardry to make it flip between each frame until I tell it to stop?

I don't REALLY want to have to use a timer for this.
 
Just use a picture box and swap in and out 2 different images (gifs) showing the off and one flashing.

Code:
Image image = Image.FromFile("Filepath here");
pictureBox1.Image = image;
 
Why don't you want to use a timer? It's the natural way to express your intention. Anything else would be a bit of a hack to be honest.
 
Why don't you want to use a timer? It's the natural way to express your intention. Anything else would be a bit of a hack to be honest.

You're right... I think i'll just use the timer... can't really use a picture box anyway.
 
Been a while since I've done winforms, but I thought if you drop a gif in a picture box it would animate... pretty sure I've done animated gifs in the past without a timer.
 
Back
Top Bottom