45fan.com - 路饭网

搜索: 您的位置主页 > 网络频道 > 阅读资讯:怎么样能够让progressbar与webbrowser关联起来?

怎么样能够让progressbar与webbrowser关联起来?

2016-08-28 18:57:49 来源:www.45fan.com 【

怎么样能够让progressbar与webbrowser关联起来?

private void Form1_Load(object sender, EventArgs e)
{
Uri url = new Uri("http://blog.csdn.net/long102");
webBrowser1.Url = url;
webBrowser1.ProgressChanged += new WebBrowserProgressChangedEventHandler(webBrowser1_ProgressChanged);
}

private void webBrowser1_ProgressChanged(object sender, WebBrowserProgressChangedEventArgs e)
{

progressBar1.Visible = true;
if ((e.CurrentProgress > 0) && (e.MaximumProgress > 0))
{
progressBar1.Maximum = Convert.ToInt32(e.MaximumProgress);
progressBar1.Step = Convert.ToInt32(e.CurrentProgress);
progressBar1.PerformStep();
}
else if (webBrowser1.ReadyState == WebBrowserReadyState.Complete)
{
progressBar1.Value = 0;
progressBar1.Visible = false;
}

}

 

本文地址:http://www.45fan.com/a/question/68995.html
Tags: 关联 Progressbar webbrowser
编辑:路饭网
关于我们 | 联系我们 | 友情链接 | 网站地图 | Sitemap | App | 返回顶部