| |

VerySource

 Forgot password?
 Register
Search
Author: datoumao

How to make progress bar sync with page load (C #)? ?

[Copy link]

0

Threads

5

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-4-18 09:15:01
| Show all posts
detail? The WebBrowser type will return the progress that has been reached through the ProgressChanged event when the download progress changes. So you only need to handle this event to update the properties of ProgressBar, just like the example above.
Reply

Use magic Report

2

Threads

9

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-7-29 20:45:01
| Show all posts
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;
            }
        }
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list