WebBrowser关于后退前进的 GoBack和GoForward 及 CanGoBack和CanGoForward

this.webBrowser1.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.webBrowser1_DocumentCompleted);
this.webBrowser1.CanGoBackChanged += new System.EventHandler(this.webBrowser1_CanGoBackChanged);
this.webBrowser1.CanGoForwardChanged += new System.EventHandler(this.webBrowser1_CanGoForwardChanged);

//后退
private void btnGoBack_myClick(object sender, EventArgs e)
{
     this.webBrowser1.GoBack();           
}

//前进
private void btnGoForward_myClick(object sender, EventArgs e)
{
     this.webBrowser1.GoForward();
}

//判断及设定 后退按钮是否可用
private void webBrowser1_CanGoBackChanged(object sender, EventArgs e)
{
      this.btnGoBack.Enabled = webBrowser1.CanGoBack;
}
//判断及设定 前进按钮是否可用
private void webBrowser1_CanGoForwardChanged(object sender, EventArgs e)
{
      this.btnGoForward.Enabled = webBrowser1.CanGoForward;
}

posted on 2008-12-30 11:11  freeliver54  阅读(6100)  评论(1编辑  收藏  举报

导航