|
楼主 |
发表于 2020-7-29 20:45:01
|
显示全部楼层
那ProgressChanged事件具体是怎么实现的呢?
我还是不太明白,就象wudi1982写的程序,谁能给偶具体解释下哈~
private void Form1_Load(object sender, EventArgs e)
{
Uri url = new Uri("http://www.163.com");
webBrowser1.Url = url;
webBrowser1.ProgressChanged+=new WebBrowserProgressChangedEventHandler(webBrowser1_ProgressChanged);
}
private void webBrowser1_ProgressChanged(object sender, WebBrowserProgressChangedEventArgs e)
{
processBar.Visible = true;
if ((e.CurrentProgress > 0) && (e.MaximumProgress > 0))
{
processBar.Maximum =Convert.ToInt32( e.MaximumProgress);
processBar.Step = Convert.ToInt32(e.CurrentProgress);
processBar.PerformStep();
}
else if (webBrowser1.ReadyState == WebBrowserReadyState.Complete)
{
processBar.Value = 0;
processBar.Visible = false;
}
}
|
|