Skip to content

About KeyEvent Solution! #4

@jerviscui

Description

@jerviscui

Hi! Man

I find a solution for the ChromiumWebBrowser KeyEvent with WinForm.

I read the blog http://www.codeproject.com/Articles/990346/Using-HTML-as-UI-Elements-in-a-WinForms-Applicatio, and you refer

[As a side-note, I initially attempted to catch the F12 key on the form, however even with KeyPreview set to true, it seemed Chrome caught all key strokes and the key preview was never caught by the WinForm class.]

  1. bind the PreviewKeyDown event and set the KeyboardHandler to a Class which implement IKeyboardHandler
  2. in IKeyboardHandler.OnPreKeyEvent(IWebBrowser browserControl,...) method, I call the Control.PreProcessControlMessage(ref Message msg) for send message to the PreviewKeyDown event
  3. Just OK.
Mail to me, friend.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions