Capture Keypress in elementhost1
#1
Hi
i have converted most of the Duck Lake sample, but i am having a problem getting the keypress event it never catches the keypress any idea how i can get it to work, this is VB.NET with elementhost btw.

Code:
Private Sub ElementHost1_KeyDown(sender As Object, e As Forms.KeyEventArgs) Handles ElementHost1.KeyDown


       Select Case e.KeyCode
           Case Key.F1 'Move
               CHK_MoveModel.Checked = True
               e.Handled = True
           Case Key.F2 'Rotate
               CHK_RotateModel.Checked = True
               e.Handled = True
           Case Key.F3 'Scale
               CHK_ScaleModel.Checked = True
               e.Handled = True
       End Select
   End Sub
thank you for any help you can give :)
#2
To get keystorkes in WinForms application I would advice you to use the method in WinForms. I am not an expert for WinForms, but you may try to subscribe to KeyDown event in the Form object.
Andrej Benedik
#3
(03-03-2021, 07:53 PM)abenedik Wrote: To get keystorkes in WinForms application I would advice you to use the method in WinForms. I am not an expert for WinForms, but you may try to subscribe to KeyDown event in the Form object.

yes i have used the form keydown event, it originally did not work until i changed keypreview to true in the form properties, sometimes you have to step back and look at it again, was a simple fix in the end :)
  


Forum Jump:


Users browsing this thread:
1 Guest(s)