Animate Image with ImageAnimator

image_pdfimage_print
   

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

public class Form1 : Form
{
  private Bitmap bmp;
  
  public Form1()
  {

  }

  private void Form1_Load(object sender, EventArgs e)
  {
    bmp = new Bitmap("arrow.gif");
    ImageAnimator.Animate(bmp, new EventHandler(this.OnFrameChanged));
  }

  private void OnFrameChanged(object o, EventArgs e)
  {
    this.Invalidate();
  }

  private void Form1_Paint(object sender, PaintEventArgs e)
  {
    ImageAnimator.UpdateFrames();
    e.Graphics.DrawImage(this.bmp, new Point(0, 0));
  }
}


           
          


This entry was posted in 2D Graphics. Bookmark the permalink.