本文介绍了vb.net web浏览器链接默认Web浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么方法来检测一个人点击里面WebBrowser1一个链接,然后我可以做
is there a way to detect a person clicking a link inside WebBrowser1, and then i can do
Process.Start(TheURL)
,然后返回动作为假,因此它不会点击WebBrowser对象和链接只是过程。
And then return the action as false so it doesn't click the link in the webbrowser object and just the process.
推荐答案
下面亚去:
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
}
编辑:咩,我有几分钟。这里亚又来了:
Meh, I had a few minutes. Here ya go again:
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
这篇关于vb.net web浏览器链接默认Web浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!