Versions des environnements
Hmm. WebBrowser control derives from Control and Control has a KeyPress event. Why do you say it WebBrowser doesn't have one? (Just looking at docs - haven't tried it.....)
UPDATE: Just tried a WebBrowser on a form with KeyPreview true. Form got the KeyPress event just fine. OTOH, you seem to be right - the WebBrowser control doesn't expose the KeyPress event (at least not in the properties window)....
>That is what I thought too. It seems very odd. The control in question is the WebBrowser control. I have found a workaround which involves a transparent panel covering the WebBrowser control and setting focus to the panel on the panel's MouseEnter, but I was hoping to find something cleaner. The transparent panel also serves another purpose and that is to display/hide the form's title bar.
>
>>That doesn't sound right. With KeyPreview=true I thought the form received all relevant keyboard events *before* the control with focus?
>>
>>>I had not set KeyPreview to true, but I have now and it didn't change anything. It appears that if the control on the form does not handle keyboard events the keyboard events are not passed to the form.
>>>
>>>>Have you set the form's KeyPreview property to True?
>>>>
>>>>>I can't figure this out. I have a form with a control that is docked to fill. The control does not support keypress (or any key input it seems). I want to capture when a key is pressed, but the form's KeyPressed event doesn't fire. I am sure there is an easy answer but I can't figure it out.
>>>>>
>>>>>Thanks,
>>>>>Einar
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement