Cant catch KeyDown event

  • Thread starter Thread starter Jørgen Sørensen
  • Start date Start date
J

Jørgen Sørensen

Hi

I have a Windows Form with nothing but an Acrobat Reader Control, which is
docked to fill the entire form.
I need to catch KeyDown events to scroll, resize etc. the document shown in
the AR Control.
Just to test I have tried the "normal" way:

Private Sub Form_KeyDown(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
MessageBox.Show("hallo")
End Sub

The Form KeyPreview is set to True

For some strange reason the code above never runs!

Help please
Jørgen
 
Jeff Gaines said:
Does the form ever get focus or is focus set to the Acrobat reader?

Yes, I guess it is a focus problem. I am trying to force focus to the form
whenever the AR has had it.

Jørgen
 
I believe KeyDown doesn't get called unless the parent form has the
KeyPreview flag set. If you need something outside the scope of a WinForm
or its components, you might want to check out user32.dll for some low-level
keyboard functions.
 
Back
Top