通过WinForm实现了一个计算功能,并且要导出数据。需要用进度条progressBar来呈现这个过程。
解决方案 »
- 访问数据库的话:“WCF服务”和“WCF数据服务”有什么各自的利弊呢?
- cookies 清空后,有些页面还是能读取值?
- 赋值问题
- 菜鸟上路,求高人指点一二。关于C#数字图像处理的
- PDF转text 怎么用C#把Stream中乱码 给翻译过来
- C# 图像操作如何实现恢复之前操作的功能?
- 关于Socket 异步读取数据的问题 EndReceive
- 要创建多个sheet怎么创建,急
- 这个问题是否需要半年或一年以上才能解决呢?还是根本就无法解决?100分请教,如何将数据库A表中的图片读出,然后再写入B表?
- 如何中断一个异步调用?
- filestram 句柄无缘无故关闭了,大侠看看吧:
- C# 获取多个键盘输入的值 在线等待
{
// Display the ProgressBar control.
pBar1.Visible = true;
// Set Minimum to 1 to represent the first file being copied.
pBar1.Minimum = 1;
// Set Maximum to the total number of files to copy.
pBar1.Maximum = filenames.Length;
// Set the initial value of the ProgressBar.
pBar1.Value = 1;
// Set the Step property to a value of 1 to represent each file being copied.
pBar1.Step = 1;
// Loop through all files to copy.
for (int x = 1; x <= filenames.Length; x++)
{
// Copy the file and increment the ProgressBar if successful.
if(CopyFile(filenames[x-1]) == true)
{
// Perform the increment on the ProgressBar.
pBar1.PerformStep();
}
}
}
Thread s2 = new Thread(new ThreadStart(NewMothod));
s2.Start(); Thread s1 = new Thread(new ThreadStart(Search));
s1.Start();
这是实现进度条的方法:
private void NewMothod()
{
for (int i = 1; i <= 10; i++)
{
Thread.Sleep(100);
progressBar.Value = i * 10;
if (autoEvents.WaitOne(10,false))
{
progressBar.Value = 100;
break;
}
}
}看看对你有没有帮助!!!