开发者

How can I use backgroundworker in my browser?

开发者 https://www.devze.com 2023-03-28 10:13 出处:网络
I\'m trying to create my own web browser for my practice on windows application. So I\'ve make a windows fo开发者_StackOverflowrm for web browser. Now I want to use backgroundworker or progressbar to

I'm trying to create my own web browser for my practice on windows application. So I've make a windows fo开发者_StackOverflowrm for web browser. Now I want to use backgroundworker or progressbar to show real process of page loading but I don't know how to do it. I tried with Google but no result for me. So please help me if my question is right to ask about it.


        // add progress bar
        private ProgressBar progressBar1;


        //create event for ProgressChanged 
        Browser.ProgressChanged += Browser_ProgressChanged;
        ...

        // set progress bar value when ProgressChanged event firing 
        void Browser_ProgressChanged(object sender, WebBrowserProgressChangedEventArgs e) {
        if (e.MaximumProgress > 0) {
            int prog = (int)(100 * e.CurrentProgress / e.MaximumProgress);
            progressBar1.Value = prog;
        }
    }
  • C# Winforms: Using a progress bar with Web Browser Control


Here are some links:

http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx

http://www.dotnetperls.com/backgroundworker

http://www.codeproject.com/KB/cs/bgworkercomponent.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号