I have a WebBwoser inside a Form, and I want to capture the Ctrl+O key combination to use as a shortcut for a menu item. My problem is that if I click on the WebBrowser and I press Ctrl+O, an Internet Explorer dialog pops up, instead of doing what my menu item does. I have my Form‘s KeyPreview property set to true. Also, I added an event handler for the KeyDown event, but it stops getting called after I click the WebBrowser. How can I fix this?
I have a WebBwoser inside a Form , and I want to capture the
Share
This should solve your problem. It disabled the accelerator keys of the web browser.
You might want to explore whether you need
IsWebBrowserContextMenuEnabledas well.The following may also solve your problem if you need some accelerators keys to be active on the browser. However, this approach requires something to capture the focus.
MessageBox.Show()anddialog.ShowDialog()can do the job