我有一个没有触发keydown事件的System.Windows.Forms webbrowser控件。
以下是代码:鼠标按下事件触发,但keydown事件不触发。是否有任何触发keydown事件的标准?
IWebBrowser2 browser;
mshtml.HTMLDocument doc;
mshtml.HTMLDocumentEvents2_Event iEvent;
browser = (IWebBrowser2)_browser.ActiveXInstance;
if (browser == null)
return;
doc = (HTMLDocument)browser.Document;
if (doc == null)
return;
iEvent = (HTMLDocumentEvents2_Event)doc;
if (iEvent != null)
{
iEvent.onkeydown += new mshtml.HTMLDocumentEvents2_onkeydownEventHandler(keyDown);
iEvent.onmousedown += new HTMLDocumentEvents2_onmousedownEventHandler(iEvent_onmousedown);
}
}
答案 0 :(得分:3)