• 大小: 0.04M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2020-12-26
  • 语言: C#
  • 标签: winform  图片  鼠标  

资源简介

鼠标拖动图片,然后图片随着鼠标移动,放开鼠标后 图片则停留在新位置,如下图效果

资源截图

代码片段和文件信息

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

namespace MouseMove
{
    public partial class Frm_Main : Form
    {
        bool flag = false;
        int x y;
        public Frm_Main()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender EventArgs e)
        {
            //设置文件的类型
            openFileDialog1.Filter = “*.jpg*.jpeg*.bmp*.gif*.ico*.png*.tif*.wmf|*.jpg;*.jpeg;*.bmp;*.gif;*.ico;*.png;*.tif;*.wmf“;
            openFileDialog1.ShowDialog();  //打开文件对话框
            Image myImage = System.Drawing.Image.FromFile(openFileDialog1.FileName);  //根据文件的路径实例化Im

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2011-12-22 23:11  MouseMove\
     文件         917  2013-05-07 10:13  MouseMove.sln
     文件       14336  2010-11-04 18:44  MouseMove.suo
     目录           0  2011-12-22 23:11  MouseMove\bin\
     目录           0  2013-05-07 10:13  MouseMove\bin\Debug\
     文件       10240  2013-05-07 10:13  MouseMove\bin\Debug\MouseMove.exe
     文件       24064  2013-05-07 10:13  MouseMove\bin\Debug\MouseMove.pdb
     文件        1904  2010-07-10 21:06  MouseMove\Frm_Main.cs
     文件        4075  2010-07-09 16:32  MouseMove\Frm_Main.designer.cs
     文件        6017  2010-07-09 16:32  MouseMove\Frm_Main.resx
     文件        3987  2013-05-07 10:13  MouseMove\MouseMove.csproj
     目录           0  2011-12-22 23:11  MouseMove\obj\
     目录           0  2013-05-07 10:13  MouseMove\obj\Debug\
     文件        7146  2013-05-07 10:13  MouseMove\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     文件        2210  2013-05-07 10:13  MouseMove\obj\Debug\MouseMove.csproj.FileListAbsolute.txt
     文件         850  2013-05-07 10:13  MouseMove\obj\Debug\MouseMove.csproj.GenerateResource.Cache
     文件        1757  2013-05-07 10:13  MouseMove\obj\Debug\MouseMove.csprojResolveAssemblyReference.cache
     文件       10240  2013-05-07 10:13  MouseMove\obj\Debug\MouseMove.exe
     文件         180  2013-05-07 10:13  MouseMove\obj\Debug\MouseMove.Frm_Main.resources
     文件       24064  2013-05-07 10:13  MouseMove\obj\Debug\MouseMove.pdb
     文件         180  2013-05-07 10:13  MouseMove\obj\Debug\MouseMove.Properties.Resources.resources
     目录           0  2011-12-22 23:11  MouseMove\obj\Debug\Refactor\
     目录           0  2013-05-07 10:13  MouseMove\obj\Debug\TempPE\
     文件        4608  2013-05-07 10:13  MouseMove\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
     文件         493  2010-07-09 16:32  MouseMove\Program.cs
     目录           0  2011-12-22 23:11  MouseMove\Properties\
     文件        1350  2010-07-09 16:31  MouseMove\Properties\AssemblyInfo.cs
     文件        2858  2013-05-07 10:13  MouseMove\Properties\Resources.Designer.cs
     文件        5612  2010-07-09 16:31  MouseMove\Properties\Resources.resx
     文件        1109  2013-05-07 10:13  MouseMove\Properties\Settings.Designer.cs
     文件         249  2010-07-09 16:31  MouseMove\Properties\Settings.settings
............此处省略0个文件信息

评论

共有 条评论