c# f3按下弹起比对图片

来源:互联网 发布:淘宝装修代码怎么写 编辑:程序博客网 时间:2024/06/02 21:01

软件 vs2010   

语言 c#

控件 picturebox & imagelist(在imagelist里面手动添加两种图片)

源代码:

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;

namespace f3刷新图片
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            //显示图片1
            pictureBox1.Image = imageList1.Images[0];
        }
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            //按下f3,显示图片2
                if (e.KeyCode == Keys.F3)
                {
                    pictureBox1.Image = imageList1.Images[1];
                }
        }
        private void Form1_KeyUp(object sender, KeyEventArgs e)
        {
            //弹出f3,显示图片1
            if (e.KeyCode == Keys.F3)
            {
                pictureBox1.Image = imageList1.Images[0];
            }
        }
    }
    }
意义: 比对两张差不多的图片,差错和比对出细微区别。

0 0