好的,我有一个基本的网络浏览器项目(后退/前进按钮,停止/刷新,以及所有必要的组件)。我正在使用工具箱中提供的Webbrowser对象。我怎么能拥有它,以便当鼠标悬停在浏览器内的链接上时,它会在表单上的标签上显示链接作为字符串(即状态标签,告诉鼠标悬停在哪个URL上)。
答案 0 :(得分:0)
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
AddHandler WebBrowser1.Document.MouseOver, AddressOf Me.DisplayHyperlinks
End Sub
Public Sub DisplayHyperlinks(ByVal sender As Object, ByVal e As System.Windows.Forms.HtmlElementEventArgs)
TextBox4.Text = e.ToElement.GetAttribute("href")
End Sub