Using System;
Using System. collections. generic; using System. componentModel; using System. data; using System. drawing; using System. text; using System. windows. forms; namespace _ 7_04 {public partial class Form1: Form {public Form1 () {InitializeComponent () ;} Bitmap bitmap = new Bitmap ("1.gif"); bool current = false; public void AnimateImage () {if (! Current) {ImageAnimator. animate (bitmap, new EventHandler (this. onFrameChanged); current = true;} private void OnFrameChanged (object o, EventArgs e) {this. invalidate ();} protected override void OnPaint (PaintEventArgs e) {AnimateImage (); ImageAnimator. updateFrames (); e. graphics. drawImage (this. bitmap, new Point (0, 0);} private void button#click (object sender, EventArgs e) {ImageAnimator. stopAnimate (bitmap, new EventHandler (this. onFrameChanged); // stop} private void button2_Click (object sender, EventArgs e) {ImageAnimator. animate (bitmap, new EventHandler (this. onFrameChanged); // play }}