WPF WebBrowser Mouse Events not working as expected

前端 未结 2 1093
無奈伤痛
無奈伤痛 2020-11-29 12:34

I have a WebBrowser object in a WPF Page and I\'m trying to do something whenever the user interacts with the page. I have intially tried to use the events associated with t

2条回答
  •  北海茫月
    2020-11-29 13:32

    Add the ms html com library

    Once the WebBrowser.LoadCompleted event fires try this:

    mshtml.HTMLDocumentEvents2_Event doc = ((mshtml.HTMLDocumentEvents2_Event)Browser.Document);
    doc.onmouseover += new mshtml.HTMLDocumentEvents2_onmouseoverEventHandler(doc_onmouseover);
    

    or use some other event.

    Hope this helps someone.

提交回复
热议问题