Dmitrij Solov

Dmitrij Solov

  • NA
  • 43
  • 6k

Animated gif-problem

Dec 2 2016 10:36 AM
Hello,
 
I want to create an animation, based on an animated gif image. In the following program I can view the Image, but not the Image animation.
I use .NET 4.0 Here is the code of the partial class:
 
  1. using System;  
  2. using System.ComponentModel;  
  3. using System.Drawing;  
  4. using System.Drawing.Drawing2D;  
  5. using System.Windows.Forms;  
  6. //animated image issue  
  7. namespace DrawingBasicsAnimation  
  8. {  
  9.     public partial class Form1 : Form  
  10.     {  
  11.         public Form1()  
  12.         {  
  13.             InitializeComponent();  
  14.         }  
  15.         private void FillRectangle1(object sender, PaintEventArgs e)  
  16.         {  
  17.             itsme = new Bitmap(@"..\..\..\..\..\..\pics\agif1.gif");  
  18.             ImageAnimator.Animate(itsme, new EventHandler(this.OnFrameChanged));  
  19.             ImageAnimator.UpdateFrames();  
  20.             e.Graphics.DrawImage(itsme, new PointF(0, 0));  
  21.         }  
  22.         private void OnFrameChanged(object o, EventArgs e)  
  23.         {  
  24.             this.Invalidate();  
  25.         }  
  26.         private Bitmap itsme;  
  27.     }  

 What am I doing wrong?

Answers (1)