C#读取键盘按键的程序
来源:互联网 发布:批处理 单片机编译 编辑:程序博客网 时间:2024/05/16 01:17
/**////用C#读取键盘按键的程?
///key.cs的代码如下:
using System ;
using System.Drawing ;
using System.Collections ;
using System.ComponentModel ;
using System.Windows.Forms ;
using System.Data ;
public class Form1 : Form
...{
private System.ComponentModel.Container components = null ;
public Form1 ( )
...{
file://初始化窗体中的各个组?
InitializeComponent ( ) ;
}
protected override void Dispose ( bool disposing )
...{
file://清除程序中使用过的资源
if ( disposing )
...{
if ( components != null )
...{
components.Dispose ( ) ;
}
}
base.Dispose ( disposing ) ;
}
private void InitializeComponent ( )
...{
this.AutoScaleBaseSize = new System.Drawing.Size ( 6 , 14 ) ;
this.ClientSize = new System.Drawing.Size ( 292 , 273 ) ;
this.Name = "Form1" ;
this.Text = "C#处理键盘事件!" ;
file://为按键的按动定义一个事件处理过程"Form1_KeyUp"
this.KeyUp += new KeyEventHandler ( this.Form1_KeyUp ) ;
}
static void Main ( )
...{
Application.Run ( new Form1 ( ) ) ;
}
file://显示你所按动的按键名称
private void Form1_KeyUp ( object sender , KeyEventArgs e )
...{
MessageBox.Show ( e.KeyCode.ToString ( ) , "您所按动的健为:" ) ;
}
}
///key.cs的代码如下:
using System ;
using System.Drawing ;
using System.Collections ;
using System.ComponentModel ;
using System.Windows.Forms ;
using System.Data ;
public class Form1 : Form
...{
private System.ComponentModel.Container components = null ;
public Form1 ( )
...{
file://初始化窗体中的各个组?
InitializeComponent ( ) ;
}
protected override void Dispose ( bool disposing )
...{
file://清除程序中使用过的资源
if ( disposing )
...{
if ( components != null )
...{
components.Dispose ( ) ;
}
}
base.Dispose ( disposing ) ;
}
private void InitializeComponent ( )
...{
this.AutoScaleBaseSize = new System.Drawing.Size ( 6 , 14 ) ;
this.ClientSize = new System.Drawing.Size ( 292 , 273 ) ;
this.Name = "Form1" ;
this.Text = "C#处理键盘事件!" ;
file://为按键的按动定义一个事件处理过程"Form1_KeyUp"
this.KeyUp += new KeyEventHandler ( this.Form1_KeyUp ) ;
}
static void Main ( )
...{
Application.Run ( new Form1 ( ) ) ;
}
file://显示你所按动的按键名称
private void Form1_KeyUp ( object sender , KeyEventArgs e )
...{
MessageBox.Show ( e.KeyCode.ToString ( ) , "您所按动的健为:" ) ;
}
}
- C#读取键盘按键的程序
- gtk 实现键盘按键的读取
- C#控制键盘按键的常用方法
- C# 中键盘按键对应的keycode
- C# 键盘中的按键对应的KeyValue
- C# 在程序焦点之外捕捉按键操作(键盘钩子的使用)
- c#重写键盘按键
- C#控制键盘按键(大小写按键等)
- C#实现的三种方式实现模拟键盘按键
- 如何在程序中模拟键盘的按键事件?
- 键盘的 meta 按键
- 【按键】短按,长按,按键释放,三种模式的按键扫描程序(软件消抖动)--- 矩阵键盘
- android模拟器按键对应的键盘按键
- Android模拟器按键对应的键盘按键
- C#模拟键盘按键(ALT,CTRL...)
- C#中窗体屏蔽键盘按键
- c# sendmessage 发送键盘按键详解
- C# 使用keybd_event()函数模拟键盘按键
- eclipse
- Spring2.0正式发布了!
- 什么时候才会有对病毒免疫的操作系统么?
- NAT时将DNS转向内部自定义的DNS服务器(iptables 命令)
- 解决IIS中端口(如80)绑定到单个IP的问题
- C#读取键盘按键的程序
- 史上最恐怖FLASH游戏咒怨(附通关攻略)
- C#文本框只能输入数字和退格
- Apache apr中内存分配子的current_free_index成员作用
- C#不分大小写的比较字符串
- C#常用函数
- C#自写函数-截取字符串某一长度并返回
- C#用户登录失败的消息提示的Login控件
- 学会批处理,用心学很容易! hjune