要求:通过网址菜单,点击某标题,就打开相应的网址
用到两个webbrowser
一个webbrowser用来保存菜单网址,一个webbrowser用来进行网址导航
网址的菜单其实是个网页,只能被打开一次
也就是说只有导航指定地址才能被导航
static string NavMenu = "
file:///" + Application.StartupPath + "
\\tilebar.htm";
private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
{
if(e.Url.ToString().Replace('/','\\')!=NavMenu.Replace('/','\\'))
e.Cancel = true;
this.webBrowser2.Navigate(e.Url.ToString());
}
{
if(e.Url.ToString().Replace('/','\\')!=NavMenu.Replace('/','\\'))
e.Cancel = true;
this.webBrowser2.Navigate(e.Url.ToString());
}
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23109131/viewspace-692824/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/23109131/viewspace-692824/