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

Winform突然不响应KeyEvent了

WBOY
Release: 2016-06-13 08:45:25
Original
1245 people have browsed it

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template