⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 介于在网上没有相关的完整实例可供参考
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;

namespace gifTest
{
    public partial class Form1 : Form
    {
        AnimateCtl animCtl = null;    //创建一个控件对象animCtl
        public Form1()
        {
            InitializeComponent();
            //实例化控件
            animCtl = new AnimateCtl();
            //从图像文件指定 Bitmap
            animCtl.Bitmap = new Bitmap(Resource.GIF2);
            //设置位置
            animCtl.Location = new Point(0, 0);
            //将控件添加到窗体
            this.Controls.Add(animCtl);
        }

        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            if ((e.KeyCode == System.Windows.Forms.Keys.Up))
            {
                // Up
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Down))
            {
                // Down
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Left))
            {
                // Left
                animCtl.StartAnimation(240, 200, -1);    //开始播放动画
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Right))
            {
                // Right
                animCtl.StopAnimation();    //停止播放动画
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Enter))
            {
                // Enter
                Application.Exit();
            }

        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -