c# 判断 按键 状态
来源:互联网 发布:cf透视辅助源码 编辑:程序博客网 时间:2024/05/16 00:33
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern short GetAsyncKeyState(int nVirtKey);
const int VK_CONTROL = 0x11;
const int VK_ALT = 0x12;
public Form1()
{
InitializeComponent();
}
private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
}
//private void Form1_KeyDown(object sender, KeyEventArgs e)
//{
// if (e.Modifiers.CompareTo(Keys.Control) == 0) ctrlDowned = true;
// timer1.Enabled = true;
//}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(GetAsyncKeyState(VK_CONTROL).ToString());
MessageBox.Show(GetAsyncKeyState(VK_ALT).ToString());
////if (GetAsyncKeyState(VK_CONTROL & 0x8000) != 0)
if (GetAsyncKeyState(VK_CONTROL) < 0)
{
MessageBox.Show("ctrl key down");
}
else
{
MessageBox.Show("ctrl key up");
}
}
//private void timer1_Tick(object sender, EventArgs e)
//{
// timer1.Enabled = false;
// ctrlDowned = false;
//}
}
}
- c# 判断 按键 状态
- vc 判断哪个按键 被按下 消息 按键 状态
- C# 判断数据库连接状态
- C#多线程状态判断
- C# 判断按键方法一[代码]
- C#判断网络连接状态
- 判断按键
- [C#]C#如何获取\设置键盘按键状态
- C#中如何判断键盘按键和组合键
- C# ListView 选中状态的判断方法
- C#如何判断文件处于打开状态
- C#判断文件打开、占用的状态
- C#如何判断文件处于打开状态
- C# 判断网络的连接状态
- C#中判断网络连接的状态
- C#中判断网络连接的状态
- C#中判断网络连接的状态
- C# 判断文件夹状态,是否被占用。。。。。
- Linux下中文乱码的解决方法
- PID概念
- apache 压缩页面
- 简单的linux动态加载
- 可用的VPN免费 自己测试成功----工具我的网盘下载
- c# 判断 按键 状态
- 总算是过了动态规划这一关了
- 09-11-09十进制转二进制、八进制、十六进制的经典程序
- SMC之抛砖引玉(VC++6.0)
- ubuntu很好玩的cairo-dock
- TCP/IP各层对应的协议
- TTL和CMOS电平总结
- 09-11-09:十进制转二进制,求其中1的个数
- 永远的魔兽