Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Loading gif for a winform

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

like image 779
Karthick Avatar asked Dec 22 '22 07:12

Karthick


1 Answers

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.

like image 93
SLaks Avatar answered Feb 10 '23 15:02

SLaks