C#Windows应用程序中的进度条 [英] progress bar in c# windows application program

查看:64
本文介绍了C#Windows应用程序中的进度条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我创建了一个Windows应用程序,它具有一些水晶报表. Crystal报告需要2到10秒才能显示,因为循环程序"可以从数据库中获取数据.我想这次放一个进度条.如何计算循环程序"和设置进度条值"所花费的时间.我是新来的.
在此先感谢
Madhukumar Viswanath

Hai all,
I create a windows application program, it have some crystal reports. crystal reports take 2 to 10 seconds to display because a ''loop program'' work to take data from the database. I want to place a progress bar in this time. How to calculate the time taken by the ''loop program'' and set ''the progress bar values''. I am the new one in this.
Thanks in advance
Madhukumar Viswanath

推荐答案

要计算报告花费的时间是完全不可能的.因此,我建议使用Marquee样式进度条指示操作正在进行,但长度不确定.
It''s quite impossible to calculate the time the report is going to take. For this reason I''d suggest using a Marquee style progress bar to indicate that the operation is going on but the length is indeterminate.


Marquee样式进度条就像进度条一样在Visual Studio中打开您的解决方案.绿色的光从栏中穿过,但没有显示任何数字.
Marquee style progress bar is like the progress bar when you open your solution in visual studio.A green light travel through the bar but no figure is shown.


private void button1_Click(object sender, EventArgs e)
       {
           int Maxitem = 0;
           Maxitem = 50000;
           progressBar1.Maximum = 50000; // your loop max no. 
           progressBar1.Value = 0;

           for (int i = 0; i < Maxitem; i++)
               progressBar1.Value += 1;


           MessageBox.Show("completed");
           progressBar1.Value = 0;
       }



如果您知道循环程序的最大数量(而不是此循环),则将放置进度条.



if you know maximum number of your loop program than in this loop you will place your progess bar.


这篇关于C#Windows应用程序中的进度条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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