Csharp/C Sharp by API/System.Drawing/ImageAnimator — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 18:31, 26 мая 2010
ImageAnimator.Animate
<source lang="csharp">
using System; using System.Collections.Generic;
using System.ruponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; public class Form1 : Form { private Bitmap bmp; public Form1() { bmp = new Bitmap("winter.jpg"); ImageAnimator.Animate(bmp, new EventHandler(this.OnFrameChanged)); this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint); } public static void Main(){ Application.Run(new Form1()); } private void OnFrameChanged(object o, EventArgs e) { this.Invalidate(); } private void Form1_Paint(object sender, PaintEventArgs e) { ImageAnimator.UpdateFrames(); e.Graphics.DrawImage(this.bmp, new Point(0, 0)); } } </source>
ImageAnimator.UpdateFrames()
<source lang="csharp">
using System; using System.Collections.Generic;
using System.ruponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; public class Form1 : Form { private Bitmap bmp; public Form1() { bmp = new Bitmap("winter.jpg"); ImageAnimator.Animate(bmp, new EventHandler(this.OnFrameChanged)); this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint); } public static void Main(){ Application.Run(new Form1()); } private void OnFrameChanged(object o, EventArgs e) { this.Invalidate(); } private void Form1_Paint(object sender, PaintEventArgs e) { ImageAnimator.UpdateFrames(); e.Graphics.DrawImage(this.bmp, new Point(0, 0)); } } </source>