为什么WebBrowser中Document的onclick事件引发很多问题?
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.WebBrowser1.Navigate("http://www.baidu.com") End Sub Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted Dim doc As mshtml.HTMLDocument = Me.WebBrowser1.Document.DomDocument Dim docevents As mshtml.HTMLDocumentEvents2_Event = DirectCast(doc, mshtml.HTMLDocumentEvents2_Event) AddHandler docevents.onclick, AddressOf Me.Doc_onclick End Sub Private Function Doc_onclick(ByVal obj As mshtml.IHTMLEventObj) As Boolean Debug.Print(obj.x) obj.returnValue = True Return True End FunctionEnd Class