|
How is the ProgressChanged event implemented?
I still don’t quite understand, just like the program written inwudi1982, who can explain to me in detail~
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;
}
} |
|