views:

458

answers:

1

Hi,

Loading gif for a winform, when i click a button i need to show loading gif then after some action it should not be displayed.

I can find tutorial for web form, but am struggling to do the same for winform, pls. suggest some idea.

Thanks, Karthick

+3  A: 

The standard PictureBox control can display animated GIFs.

Make a PictureBox on your form, set its Image property to an animated GIF, and set its Visible property to false.

Then, when you want to perform your action, set the PictureBox's Visible property to true in code, perform the action, and set it to false again.

Note that if you perform your action on the UI thread, the form, including the animation, will freeze until it finishes. To solve this, look at the BackgroundWorker component.

SLaks
Thank you SLaks.
Karthick
You should accept this answer by clicking the hollow check-mark.
SLaks
That's bad he didn't marked it as answer.
Ismail