1

I used this control but it does not support GIF file format, as the picture does not move like in PictureBox.

Community
  • 1
  • 1
TYeeTY
  • 577
  • 8
  • 16
  • You could convert your pictures from GIF to a format that is actually supported (PNG maybe?) – Uwe Keim Aug 13 '12 at 10:06
  • I want My Picture to animate!!! actually, this is a circle for loading, it orbits till something loads – TYeeTY Aug 13 '12 at 10:11

1 Answers1

0

Try to use Bitmap.MakeTransparent and ImageAnimator.UpdateFrames in OnPaint event for simple PictureBox:

private Image animGif;// gif animation file

private void Form1_Load(object sender, EventArgs e)
{
    animGif = new Bitmap("file.png");
    ImageAnimator.Animate(animGif, Animate);
}

private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
    ImageAnimator.UpdateFrames();
    var img = new Bitmap(animGif, animGif.Width, animGif.Height);
    img.MakeTransparent(Color.White);
    e.Graphics.Clear(pictureBox1.BackColor);
    e.Graphics.DrawImage(img, new Point(0, 0));
}

private void Animate(object sender, EventArgs e)
{
    pictureBox1.Invalidate();
}
Ria
  • 10,237
  • 3
  • 33
  • 60