zoukankan      html  css  js  c++  java
  • 播放动画

    编辑器加载中...

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Drawing.Drawing2D;
    using System.Drawing.Imaging;
    using System.Drawing.Text;

    namespace WindowsFormsApplication1
    {
    public partial class Form1 : Form
    {
    //首先创建一个窗体级的变量,来表示动画。
    private Bitmap bmp;
    public Form1()
    {
    InitializeComponent();
    }
    //给窗体添加load时间处理程序
    private void Form1_Load(object sender, EventArgs e)
    {
    bmp = new Bitmap("te.gif");
    ImageAnimator.Animate(bmp, new EventHandler(this.OnFrameChanged));
    }
    //如果手工制作,就需要吧这行代码添加到InitializeComponent()中:
    //private void InitializeComponent(){
    //this.load += new System.EventHandler(this.Form1_Load);}
    //然后需要Paint事件处理程序
    private void Form1_Paint(object sender, PaintEventArgs e)
    {
    //get the next frame ready for rendering
    ImageAnimator.UpdateFrames();
    //Draw the next frame in the animation.
    e.Graphics.DrawImage(this.bmp, new Point(0, 0));
    }
    private void OnFrameChanged(object o, EventArgs e)
    {
    //Invalidate the window to force a call to the paint event handler.
    //if we had more items in the window than just the animation,we coule
    //invalidate just the area occupied by the animation.
    this.Invalidate();
    }
    }
    }
    //为了使这个例子运行起来,加载的文件必须是一个GIF动画.
  • 相关阅读:
    监控神器-普罗米修斯Prometheus的安装
    Prometheus+Grafana搭建监控系统
    Win10安装PyQt5与Qt Designer
    分区 partition
    16-成绩3
    15-成绩2
    14-票价问题
    13-union 、distinc、 join
    集群无法启动的问题?
    12-order by和group by 原理和优化 sort by 倒叙
  • 原文地址:https://www.cnblogs.com/ttssrs/p/2396505.html
Copyright © 2011-2022 走看看