Web浏览器中progressBar的增量负载 [英] Incremental load for progressBar in webbrowser

查看:81
本文介绍了Web浏览器中progressBar的增量负载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

-== webbrowser中progressBar的增量负载=-
加载页面时,progressBar会多次加载",其代码如下:

-=Incremental load for progressBar in webbrowser=-
When a page is loading, the progressBar is "Loading" multiple times, with this code:

       //progressbar for page loading
        int max = 0;
        int now = 0;
private void webBrowser1_ProgressChanged(object sender, WebBrowserProgressChangedEventArgs e)
        {
                max = Convert.ToInt32(e.MaximumProgress);
                now = Convert.ToInt32(e.CurrentProgress);

                progressBarPageLoading.Maximum = max;
                if (now > 0 && now < max)//now = -1 sometimes and greater than max other times; strange.
                {
                    progressBarPageLoading.Value = now;
                }   
        }


我希望progressBar显示增量负载(不是从0开始每页两次).
以及为什么这样做呢? (我认为是因为它后面的JavaScript/或多种形式,图片,标题)?
谢谢.


I want that progressBar to display an incremental load (not starting from 0 a couple of times per page).
And why it does that, by the way? (i assume because of the javascript behind it/ or multiple forms,images,headings)?
Thanks.

推荐答案

我还没有尝试过,但是应该很容易.只需将进度条更改内容放入另一个子目录中即可.然后,创建一个称为flag的变量或您想要的任何变量,并将其设为布尔值.然后在子内容的开头将其设为true.然后,在所有子内容的末尾将其设置为false.在webbrowser文档中,只需执行一条if语句,说如果flag为true,则它将不会启动该子项.如果为假,则启动子程序.

希望您能理解(我很着急,所以我不得不非常快速地输入:P)
I haven''t tried it but it should be easy. Just put the progressbar changing stuff into another sub. Then make a variable called flag or whatever you want it to be and make it a Boolean. Then at the start of the sub stuff make it true. Then at the end of all the sub stuff make it false. In the webbrowser document sub just make an if statement saying if flag is true then it won''t start the sub. if its false then it starts the sub.

I hope you understand (I''m rushed so I had to type very quickly :P )


这篇关于Web浏览器中progressBar的增量负载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆