using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Bitmap animatedImage = new Bitmap("C:/bb.gif");
public bool currentlyAnimating=false;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("Hello");
}
private void Form1_Load(object sender, EventArgs e)
{
AnimateImage();
}
private void AnimateImage()
{
if (!currentlyAnimating)
{
ImageAnimator.Animate(animatedImage,new EventHandler(this.OnFrameChanged));
currentlyAnimating = true;
}
}
private void OnFrameChanged(Object Sender,EventArgs e)
{
this.Invalidate();
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
AnimateImage();
ImageAnimator.UpdateFrames();
e.Graphics.DrawImage(this.animatedImage, new Point(150, 20));
}
}
}
Technorati Tags: VC#.NET
Comments
Post a Comment