播放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));

posted @ 2011-05-13 22:56  joe62  阅读(271)  评论(0编辑  收藏  举报