【发布时间】:2011-07-12 07:46:34
【问题描述】:
有没有办法检测一个人点击 WebBrowser1 中的链接,然后我可以做
Process.Start(TheURL)
然后将操作返回为 false,这样它就不会单击 webbrowser 对象中的链接,而只是单击进程。
【问题讨论】:
有没有办法检测一个人点击 WebBrowser1 中的链接,然后我可以做
Process.Start(TheURL)
然后将操作返回为 false,这样它就不会单击 webbrowser 对象中的链接,而只是单击进程。
【问题讨论】:
来吧:
private void WebBrowser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
{
e.Cancel = true; // Cancel the event to avoid default behavior
System.Diagnostics.Process.Start(e.Url.ToString()); // Open the link in the default browser
}
编辑:嗯,我有几分钟。又来了:
Private Sub WebBrowser1_Navigating(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserNavigatingEventArgs) Handles WebBrowser1.Navigating
e.Cancel = True 'Cancel the event to avoid default behavior
System.Diagnostics.Process.Start(e.Url.ToString()) 'Open the link in the default browser
End Sub
【讨论】: