如何知道我的C#程序正在运行时正在按下哪个键? [英] How to know which key is being pressed when my C# program is running..?

查看:112
本文介绍了如何知道我的C#程序正在运行时正在按下哪个键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当按下一个键时,程序必须自动检测出按下了哪个键...
我必须使用哪个功能? ProcessDialogKey()????哪一个???我是该领域的初学者..所以plzzzzzzz帮助那里的一些人........

Whenever a key is being pressed, the program must automatically detect which key is being pressed...
For that which function i must use? ProcessDialogKey()???? which one??? Im a beginner in this area.. so plzzzzzzz help some body out there..........

推荐答案

Hi

不幸的是,如果您的应用程序是Windows窗体或控制台应用程序,则在窗体/控件处于活动状态时,如果需要获取系统范围的键或仅按下这些键,则无需编写.

对于最后一种情况是检查事件Form.KeyDown.帮助中也有一个很好的例子.

Hi

unfortunately you don't write if your application is a Windows Form or a console application, if you need to get the keys system wide or only those keys pressed, while the form / control is active.

For the last situation check the event Form.KeyDown. There is a good example in the help as well.

http://msdn.microsoft.com/en-us /library/system.windows.forms.control.keydown.aspx


注意事项

Alex

http://msdn.microsoft.com/en-us/library/system.windows.forms.control.keydown.aspx


Regards

Alex


这篇关于如何知道我的C#程序正在运行时正在按下哪个键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆