-
Jan 23rd, 2021, 07:58 AM
#1
Thread Starter
Junior Member
Overriding webbrowser control's shortcuts
If I drag a web browser control in a form and then press key combination like Ctrl+O, Ctrl+P, Ctrl+K etc, it performs some predetermined operations.
How I can override these behavior with my own actions?
I want to override only few specific keys not everything.
For example, I still want to keep default Ctrl+B for making text bold but want to do something else when user presses Ctrl+P (rather than showing default behavior of print dialog) or use Ctrl+K for strikethru rather than showing default insert hyperlink option.
Thanx
Last edited by mobi12; Jan 23rd, 2021 at 08:46 AM.
-
Jan 23rd, 2021, 08:37 AM
#2
Thread Starter
Junior Member
Re: Overriding webbrowser control's shortcuts
OK, managed to do it in web browser's PreviewKeyDown event. It did not work with Form's keyup/down or keypress events.
Code:
Private Sub wb_PreviewKeyDown(sender As Object, e As System.Windows.Forms.PreviewKeyDownEventArgs) Handles wb.PreviewKeyDown
If e.KeyCode = Keys.P AndAlso e.Modifiers = Keys.Control Then
MessageBox.Show("captured")
End If
End Sub
But the problem remains, after I captured this event and wrote my code (which works fine) it still pops up Print dialog box! How do I suppress that?
Last edited by mobi12; Jan 23rd, 2021 at 08:45 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|