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...