Home  >  Article  >  Backend Development  >  Winform突然不响应KeyEvent了_PHP教程

Winform突然不响应KeyEvent了_PHP教程

WBOY
WBOYOriginal
2016-07-12 08:58:14894browse

Winform突然不响应KeyEvent了

一开始WINFORM的KeyEvent是有效的。

image

当使用一些控件设置其MouseEvent后,Winform突然不响应KeyEvent了!!

image

可以按下面步骤解决:


1、先将Form.KeyPreview设为True试试。

KeyPreview的作用是确定窗体上控件的键盘事件是否已向窗体注册。我按上述设置后,Form的KeyEvent又活了。


image

如果还不行,按2.


2、需要重载此函数

protected override bool ProcessDialogKey(Keys keyData)



参考文献:

http://m.myexception.cn/c-sharp/78949.html

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1104551.htmlTechArticleWinform突然不响应KeyEvent了 一开始WINFORM的KeyEvent是有效的。 当使用一些控件设置其MouseEvent后,Winform突然不响应KeyEvent了!! 可以按下面步骤...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn