ProgressBar用于多个WebBrowser实例

时间:2010-09-27 18:40:32

标签: c# winforms

如何将多个(动态数量)WebBrowser的CurrentProgress属性聚合在一起,以便ProgressBar看起来准确?

1 个答案:

答案 0 :(得分:0)

if (currentProgressBar != null)
        {
            (currentProgressBar as ToolStripProgressBar).Maximum = (currentProgressBar as ToolStripProgressBar).Maximum;
            (currentProgressBar as ToolStripProgressBar).Value = preValue + ((100 * (Int32)e.CurrentProgress) / (Int32)e.MaximumProgress);
            if (e.CurrentProgress >= e.MaximumProgress)
            {
                preValue = (currentProgressBar as ToolStripProgressBar).Value;
            }
        }

这就是我能够让进度条正确显示多个Web浏览器控件的方式。