If you have Outlook for Office 365, version 2008 or higher, use Windows 10 to enable animated GIFs. Click Start and type Show animations. Click the search result and under Simplify and personalize Windows, enable Show animations in Windows.
Why don't GIF images work on my computer? If it only doesn't show the animation that it because the Windows built-in picture viewer does not support animated GIFs. You can either try your browser as a viewer (via drag&drop) or use some third party picture viewer e.g. IrfanView .
It's not too hard.
Things to take into consideration:
Animated gifs:
If you are looking for animated gifs you can generate them:
AjaxLoad - Ajax Loading gif generator
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
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.
  private void MyThreadRoutine()
  {
   this.Invoke(this.ShowProgressGifDelegate);
   //your long running process
   System.Threading.Thread.Sleep(5000);
   this.Invoke(this.HideProgressGifDelegate);
  }
  private void button1_Click(object sender, EventArgs e)
  {
   ThreadStart myThreadStart = new ThreadStart(MyThreadRoutine);
   Thread myThread = new Thread(myThreadStart);
   myThread.Start(); 
  }
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).
If you put it in a PictureBox control, it should just work
It doesn't when you start a long operation behind, because everything STOPS since you'Re in the same thread.
Public Class Form1
    Private animatedimage As New Bitmap("C:\MyData\Search.gif")
    Private currentlyanimating As Boolean = False
    Private Sub OnFrameChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Invalidate()
    End Sub
    Private Sub AnimateImage()
        If currentlyanimating = True Then
            ImageAnimator.Animate(animatedimage, AddressOf Me.OnFrameChanged)
            currentlyanimating = False
        End If
    End Sub
    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
        AnimateImage()
        ImageAnimator.UpdateFrames(animatedimage)
        e.Graphics.DrawImage(animatedimage, New Point((Me.Width / 4) + 40, (Me.Height / 4) + 40))
    End Sub
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        BtnStop.Enabled = False
    End Sub
    Private Sub BtnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnStop.Click
        currentlyanimating = False
        ImageAnimator.StopAnimate(animatedimage, AddressOf Me.OnFrameChanged)
        BtnStart.Enabled = True
        BtnStop.Enabled = False
    End Sub
    Private Sub BtnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnStart.Click
        currentlyanimating = True
        AnimateImage()
        BtnStart.Enabled = False
        BtnStop.Enabled = True
    End Sub
End Class
    
                If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With