Csharp/C Sharp by API/System.Drawing/ImageAnimator — различия между версиями

Материал из .Net Framework эксперт
Перейти к: навигация, поиск
м (1 версия)
 
м (1 версия)
 
(нет различий)

Текущая версия на 12:11, 26 мая 2010

ImageAnimator.Animate

  

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));
    }
  }


ImageAnimator.UpdateFrames()

  

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));
    }
  }