|
发表于 2020-1-26 20:54:01
|
显示全部楼层
建立委托:
_axWebBrowser.ProgressChange += new
AxSHDocVw.DWebBrowserEvents2_ProgressChangeEventHandler(
this.mainBrowser_ProgressChange);
再处理:
private void mainBrowser_ProgressChange(object sender, AxSHDocVw.DWebBrowserEvents2_ProgressChangeEvent e)
{//处理进度条事件
AxSHDocVw.AxWebBrowser axWebBrowser1 = (AxSHDocVw.AxWebBrowser)sender;
HE_WebBrowserTag _HE_WebBrowserTag = (HE_WebBrowserTag)axWebBrowser1.Tag;
//如果当前页面和当前webbrowser不匹配,那么放弃它
if (_HE_WebBrowserTag._TabIndex != this.MainTabCtrl.SelectedIndex) { return; }
processBar.Visible = true;
if ((e.progress > 0) && (e.progressMax > 0))
{
processBar.Maximum = e.progressMax;
processBar.Step = e.progress;
processBar.PerformStep();
}
else if (axWebBrowser1.ReadyState == SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE)
{
processBar.Value = 0;
processBar.Visible = false;
}
} |
|