Friday, November 4, 2016

How to let SharpGL capturing KeyDown event?

Issue:

  • SharpGL won't capture KeyDown event
Solution:
  • Make OpenGLControl focusable, like this: Focusable="True"
  • Set focus on the OpenGL control in the hosting window: OpenGLControl.Focus();
If the OpenGL control is in a User Control, then set focus on the user control in the hosting window of the user control.