Home  >  Article  >  php教程  >  Winform突然不响应KeyEvent了

Winform突然不响应KeyEvent了

WBOY
WBOYOriginal
2016-06-13 08:45:251190browse

Winform突然不响应KeyEvent了

一开始WINFORM的KeyEvent是有效的。

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

可以按下面步骤解决:


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

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


如果还不行,按2.


2、需要重载此函数

protected override bool ProcessDialogKey(Keys keyData)



参考文献:

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

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