Animated Gif in form using C#

Posted by Rabin on Stack Overflow See other posts from Stack Overflow or by Rabin
Published on 2010-06-18T10:09:32Z Indexed on 2010/06/18 10:13 UTC
Read the original article Hit count: 360

Filed under:

In my project, whenever a long process in being executed, a small form is displayed with a small animated gif file. I used this.Show() to open the form and this.Close() to close the form. Following is the code that I use.

public partial class PlzWaitMessage : Form
{
   public PlzWaitMessage()
   {
      InitializeComponent();
   }

   public void ShowSpalshSceen()
   {
      this.Show();
      Application.DoEvents();
   }

   public void CloseSpalshScreen()
   {
      this.Close();
   }
}

When the form opens, the image file do not immediately start animating. And when it does animate, the process is usually complete or very near completion which renders the animation useless. Is there a way I can have the gif animate as soon as I load the form?

© Stack Overflow or respective owner

Related posts about c#