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

怎么样能够让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;
}

}