登录
首页 » 其他 » Visual C# 使用键盘控制窗体的移动

Visual C# 使用键盘控制窗体的移动

于 2022-03-13 发布 文件大小:223.74 kB
0 211
下载积分: 2 下载次数: 1

代码说明:

Visual C#使用键盘控制窗体的移动,创建窗体对象,设置窗体接收按键事件,定义一个标识窗体的变量,判断按键类型,判断后关闭本窗体。   private void Form1_Load(object sender, EventArgs e)   {    Frm_Main form1 = new Frm_Main();//创建窗体对象    form1.KeyPreview = true;//设置窗体接收按键事件   }   private void Form1_KeyDown(object sender, KeyEventArgs e)   {    Point point = this.Location;//定义一个标识窗体的变量    switch (e.KeyData)//判断按键类型    {    case Keys.Up://当按键为上方向键时    point.Y -= 2;    break;    case Keys.Down://当按键为下方向键时    point.Y += 2;    break;    case Keys.Right://当按键为右方向键时    point.X += 2;    break;    case Keys.Left://当按键为左方向键时    point.X -= 2;    break;    case Keys.Escape://当按键为Esc键时    this.Close();//关闭本窗体    break;    default: break;    }    this.Location = point;   }

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 一个关于LabVIEW的pwm程序,还没有最终完成
    一个关于LabVIEW的pwm程序,还没有最终完成-pwm
    2022-01-26 00:20:57下载
    积分:1
  • 拼图游戏,教材上的,比较经典,希望大家支持一下。
    拼图游戏,教材上的,比较经典,希望大家支持一下。-Jigsaw puzzle, teaching materials on comparing the classic I hope you will support you.
    2022-08-21 00:19:11下载
    积分:1
  • USB的RTL代码,FPGA或ASIC
    usb rtl code, to fpga or asic
    2023-01-20 16:30:03下载
    积分:1
  • xhtml到rtf的转换程序!带源码!
    xhtml到rtf的转换程序!带源码!-xhtml to rtf transformation procedure! Belt source code!
    2022-01-21 00:06:12下载
    积分:1
  • HTML5 圆形3D按钮代码
    HTML5 圆形3D按钮代码,本按钮支持鼠标各个状态的变化,比如悬停、单击、单击之后的各个状态变化,圆形带阴影的按钮,清新风格,基于CSS3代码美化,运行于手机端或HTML5浏览器中,在电脑端测试请使用火狐、Chrome或Opera等浏览器。
    2022-07-02 22:04:41下载
    积分:1
  • capture keyboard operation records
    捕获键盘操作的记录-capture keyboard operation records
    2022-03-17 17:38:38下载
    积分:1
  • 这是用C++编写的程序,可以实现多项式的求和。
    这是用C++编写的程序,可以实现多项式的求和。-C preparation procedures can be achieved polynomial summation.
    2023-04-12 02:05:04下载
    积分:1
  • This system is a competition I took part in ESRI works mainly use the GIS capabi...
    本系统是我参加ESRI大赛的一个作品 主要利用GIS功能对水土流失模型USLE中的各个因子的提取(如根基降雨量站点插值生成等值线,利用等高线生成TIN提取坡度,坡向等)再生成专题图输出。系统包含数据采用的ACCESS,有对数据库的通用操作,以及各种绘图分析,如对年、月、日的降雨量,流量等的图形对比分析等等。系统功能还算比较完善。 是基于VB6.0+ArcEngine9.2开发,皮肤界面用的是Activebar3.0 里面的数据比较大,不便上传,需要的可向我索要。-This system is a competition I took part in ESRI works mainly use the GIS capabilities of the USLE soil erosion model for the extraction of the various factors (such as the foundations of rainfall site, contour interpolation, using contour lines generated TIN extraction slope, aspect, etc. ) and then generate the thematic map output. System contains the data used in ACCESS, there is a common database operations, and a variety of mapping analysis, such as year, month, day of rainfall, flow, etc. graphic correlation and so forth. Relatively perfect system functions fairly. Is based on VB6.0+ ArcEngine9.2 development, the skin interface, using a relatively large data inside Activebar3.0, inconvenience upload, need to be to my request.
    2023-06-23 08:40:03下载
    积分:1
  • 电力系统101规约
    电力系统101规约-power system 101 Statute
    2022-05-08 16:05:50下载
    积分:1
  • 本程序用C语言实现了读一个.txt文档中一行数据的功能。希望对大家有用。有不对的地方请指正。...
    本程序用C语言实现了读一个.txt文档中一行数据的功能。希望对大家有用。有不对的地方请指正。-This procedure using C language to implement reading a. Txt document in the line of data. Want to be useful to everyone. Where there is something wrong please correct me.
    2022-04-12 00:08:21下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载