播放GIF图像

用.NET 自带的 ImageAnimator类来播放GIF图像

1. 注册动画事件
ImageAnimator.Animate(animatedImage, new EventHandler(this.OnFrameChanged));


2. 在OnFrameChanged事件中调用this.Invalidate();

3.  在OnPaint中绘当前帧
ImageAnimator.UpdateFrames(adimatedImage);
e.Graphics.DrawImage(adinatedImage, new Point(0,0));

你可能感兴趣的:(gif)