Winform suddenly stopped responding to KeyEvent
In the beginning, WINFORM's KeyEvent was valid.
After using some controls to set their MouseEvent, Winform suddenly stopped responding to KeyEvent! !
You can solve it by following the steps below:
1. Try setting Form.KeyPreview to True first.
The function of KeyPreview is to determine whether the keyboard events of the controls on the form have been registered with the form. After I pressed the above settings, the Form's KeyEvent became alive again.
If it still doesn’t work, press 2.
2. This function needs to be overloaded
protected override bool ProcessDialogKey(Keys keyData)
Reference:
http://m.myexception.cn /c-sharp/78949.html
http://www.bkjia.com/PHPjc/1104551.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1104551.htmlTechArticleWinform suddenly does not respond to KeyEvent. At first, WINFORM's KeyEvent is valid. After using some controls to set their MouseEvent, Winform suddenly stopped responding to KeyEvent! ! You can follow the steps below...
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