bool animatingFlag = false;//设定动画标志
Bitmap gifImage= new Bitmap("D:/Geoff.Image/Temp/1.gif");
public void AnimateImage()
{
if (!animatingFlag)
{
ImageAnimator.Animate(gifImage, new EventHandler(this.OnFrameChanged));
animatingFlag = true;
}
}
private void OnFrameChanged(object o, EventArgs e)
{
this.Invalidate();
}
protected override void OnPaint(PaintEventArgs e)
{
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.DoubleBuffer, true);
AnimateImage();//开始显示动画
ImageAnimator.UpdateFrames();
e.Graphics.DrawImage(this.gifImage, new Point(100, 100));//指定显示位置
}
Bitmap gifImage= new Bitmap("D:/Geoff.Image/Temp/1.gif");
public void AnimateImage()
{
if (!animatingFlag)
{
ImageAnimator.Animate(gifImage, new EventHandler(this.OnFrameChanged));
animatingFlag = true;
}
}
private void OnFrameChanged(object o, EventArgs e)
{
this.Invalidate();
}
protected override void OnPaint(PaintEventArgs e)
{
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.DoubleBuffer, true);
AnimateImage();//开始显示动画
ImageAnimator.UpdateFrames();
e.Graphics.DrawImage(this.gifImage, new Point(100, 100));//指定显示位置
}