• 大小: 58KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-23
  • 语言: C#
  • 标签: 图片  

资源简介

图片鼠标,键盘事件,右键正转,左键反转,鼠标上下左右。完整代码,截图,报告!c#

资源截图

代码片段和文件信息

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

namespace WindowsFormsApplication5
{
    public partial class Form1 : Form
    {
        int xx = 0;//初始化x坐标移动距离
        int yy = 0;//初始化y坐标移动距离
        int jiaodu = 10;//初始化旋转角度
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender EventArgs e)
        {
}

        private void Form1_KeyDown(object sender KeyEventArgs e)
        {
            Graphics g = this.CreateGraphics();
            Bitmap curBitmap = new Bitmap(@“11.jpg“);
            Matrix X = new Matrix();
            if (e.KeyValue == 37)//判断键盘左键
            {   xx -= 10; 
                g.Clear(this.BackColor);
                X.Translate(xx yy);
                g.Transform = X;
                g.DrawImage(curBitmap
                        new Rectangle(100 100 200 200)
                        0 0 curBitmap.Width
                        curBitmap.Height
                        GraphicsUnit.Pixel);
                label1.Text = “图片向左移动“+10;
                curBitmap.Dispose();
                g.Dispose();
            }
            if (e.KeyValue == 38)//判断键盘上键
            {
                yy -= 10;
                g.Clear(this.BackColor);
                X.Translate(xx yy);
                g.Transform = X;
                g.DrawImage(curBitmap
                        new Rectangle(100 100 200 200)
                        0 0 curBitmap.Width
                        curBitmap.Height
                        GraphicsUnit.Pixel);
                label1.Text = “图片向上移动“ + 10;
                curBitmap.Dispose();
                g.Dispose();//释放资源
            }
            if (e.KeyValue == 39)//判断键盘右键
            {
                xx += 10;
                g.Clear(this.BackColor);
                X.Translate(xx yy);
                g.Transform = X;
                g.DrawImage(curBitmap
                    new Rectangle(100 100 200 200)
                    0 0 curBitmap.Width
                    curBitmap.Height
                    GraphicsUnit.Pixel);
                curBitmap.Dispose();
                g.Dispose();//释放资源
                label1.Text = “图片向右移动“ + 10;
               
            }
            if (e.KeyValue == 40)//判断键盘下键
            {
                yy += 10;
                g.Clear(this.BackColor);
                X.Translate(xx yy);
                g.Transform = X;
                g.DrawImage(curBitmap
                    new Rectangle(100 100 200 200)
                    0 0 curBitmap.Width
                    curBitmap.Height
                    GraphicsUnit.Pixel);
                curBitmap.Dispose();
                g.Dispose();//释放资

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      13522  2009-11-29 08:55  WindowsFormsApplication6000\WindowsFormsApplication5\bin\Debug\11.jpg

     文件      12288  2009-11-29 09:04  WindowsFormsApplication6000\WindowsFormsApplication5\bin\Debug\WindowsFormsApplication5.exe

     文件      36352  2009-11-29 09:04  WindowsFormsApplication6000\WindowsFormsApplication5\bin\Debug\WindowsFormsApplication5.pdb

     文件      14328  2009-11-29 09:04  WindowsFormsApplication6000\WindowsFormsApplication5\bin\Debug\WindowsFormsApplication5.vshost.exe

     文件        490  2009-06-11 05:14  WindowsFormsApplication6000\WindowsFormsApplication5\bin\Debug\WindowsFormsApplication5.vshost.exe.manifest

     文件       5522  2009-11-29 09:04  WindowsFormsApplication6000\WindowsFormsApplication5\Form1.cs

     文件       3378  2009-11-29 08:45  WindowsFormsApplication6000\WindowsFormsApplication5\Form1.Designer.cs

     文件       7730  2009-11-29 08:45  WindowsFormsApplication6000\WindowsFormsApplication5\Form1.resx

     文件       2350  2009-11-29 09:01  WindowsFormsApplication6000\WindowsFormsApplication5\obj\Debug\WindowsFormsApplication5.csproj.FileListAbsolute.txt

     文件        847  2009-11-29 08:45  WindowsFormsApplication6000\WindowsFormsApplication5\obj\Debug\WindowsFormsApplication5.csproj.GenerateResource.Cache

     文件      12288  2009-11-29 09:04  WindowsFormsApplication6000\WindowsFormsApplication5\obj\Debug\WindowsFormsApplication5.exe

     文件       1644  2009-11-29 08:45  WindowsFormsApplication6000\WindowsFormsApplication5\obj\Debug\WindowsFormsApplication5.Form1.resources

     文件      36352  2009-11-29 09:04  WindowsFormsApplication6000\WindowsFormsApplication5\obj\Debug\WindowsFormsApplication5.pdb

     文件        180  2009-11-28 12:34  WindowsFormsApplication6000\WindowsFormsApplication5\obj\Debug\WindowsFormsApplication5.Properties.Resources.resources

     文件       1062  2009-11-29 09:04  WindowsFormsApplication6000\WindowsFormsApplication5\obj\Debug\WindowsFormsApplication6000.csproj.FileListAbsolute.txt

     文件        847  2009-11-29 09:04  WindowsFormsApplication6000\WindowsFormsApplication5\obj\Debug\WindowsFormsApplication6000.csproj.GenerateResource.Cache

     文件        505  2009-11-28 12:32  WindowsFormsApplication6000\WindowsFormsApplication5\Program.cs

     文件       1404  2009-11-28 12:32  WindowsFormsApplication6000\WindowsFormsApplication5\Properties\AssemblyInfo.cs

     文件       2898  2009-11-28 12:32  WindowsFormsApplication6000\WindowsFormsApplication5\Properties\Resources.Designer.cs

     文件       5612  2009-11-28 12:32  WindowsFormsApplication6000\WindowsFormsApplication5\Properties\Resources.resx

     文件       1109  2009-11-28 12:32  WindowsFormsApplication6000\WindowsFormsApplication5\Properties\Settings.Designer.cs

     文件        249  2009-11-28 12:32  WindowsFormsApplication6000\WindowsFormsApplication5\Properties\Settings.settings

     文件       3759  2009-11-28 12:34  WindowsFormsApplication6000\WindowsFormsApplication5\WindowsFormsApplication6000.csproj

     文件        968  2009-11-29 09:01  WindowsFormsApplication6000\WindowsFormsApplication6000.sln

    ..A..H.     15872  2009-11-29 09:04  WindowsFormsApplication6000\WindowsFormsApplication6000.suo

     目录          0  2009-11-28 12:32  WindowsFormsApplication6000\WindowsFormsApplication5\obj\Debug\TempPE

     目录          0  2009-11-29 08:56  WindowsFormsApplication6000\WindowsFormsApplication5\bin\Debug

     目录          0  2009-11-29 09:04  WindowsFormsApplication6000\WindowsFormsApplication5\obj\Debug

     目录          0  2009-11-28 12:32  WindowsFormsApplication6000\WindowsFormsApplication5\bin

     目录          0  2009-11-28 12:32  WindowsFormsApplication6000\WindowsFormsApplication5\obj

............此处省略6个文件信息

评论

共有 条评论