Sunday, January 11, 2009

Animate Image with Image Animator in C# tutorial example

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));
}
}

0 comments:

Followers

Get our toolbar!

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | JCPenney Coupons