I have a form showing progress messages as a fairly long process runs. It's a call to a web service so I can't really show a percentage complete figure on a progress bar meaningfully. (I don't particularly like the Marquee property of the progress bar)
I would like to show an animated GIF to give the process the feel of some activity (e.g. files flying from one computer to another like Windows copy process).
How do you do this?
If you put it in a PictureBox control, it should just work
I had the same problem. Whole form (including gif) stopping to redraw itself because of long operation working in the background. Here is how i solved this.
I simply created another thread to be responsible for this operation. Thanks to this initial form continues redrawing without problems (including my gif working). ShowProgressGifDelegate and HideProgressGifDelegate are delegates in form that set visible property of pictureBox with gif to true/false.
Note that in Windows, you traditionally don't use animated Gifs, but little AVI animations: there is a Windows native control just to display them. There are even tools to convert animated Gifs to AVI (and vice-versa).
I had the same issue and came across different solutions by implementing which I used to face several different issues. Finally, below is what I put some pieces from different posts together which worked for me as expected.
Here is the Execution method that also carries invoking the PictureBox control:
Keep in mind, the PictureBox is invisible from Properties Window or do below:
It doesn't when you start a long operation behind, because everything STOPS since you'Re in the same thread.
It's not too hard.
Things to take into consideration:
Animated gifs:
If you are looking for animated gifs you can generate them here
Another way of doing it:
Another way that I have found that works quite well is the async dialog control that I found on the code project