更新时间:2023-11-27 20:55:52
当用户单击链接时,将触发导航事件.在事件处理程序中,您可以取消导航并在默认浏览器中启动相同的Uri.
When the user clicks on a link, a Navigating event will trigger. In the event handler, you can cancel the navigation and launch the same Uri in the default browser.
webBrowser.Navigating += webBrowser_Navigating;
...
void webBrowser_Navigating(object sender, NavigatingEventArgs e)
{
e.Cancel = true;
WebBrowserTask browserTask = new WebBrowserTask();
browserTask.Uri = e.Uri;
browserTask.Show();
}