ProgressBar实时进度条组件下载地址:http://download.csdn.net/detail/ptyzhu/5321399
示例如下:
protected void Button1_Click(object sender, EventArgs e)
{
//建立一个后台任务
System.Threading.Thread th = new System.Threading.Thread(progress);
//建立一个进度条控制类,连接ProgressBar1,将进度条SN作为构造函数的参数传递进去
AntarDev.ProgressBarController npc = new AntarDev.ProgressBarController(ProgressBar1.SN);
//启动后台任务,将进度条控制对象npc传递进去
th.Start(npc);
//启动进度条
ProgressBar1.Begin();
}
//这是一个模拟的后台任务
public static void progress(object obj)
{
AntarDev.ProgressBarController pc = (AntarDev.ProgressBarController)obj;
for (int i = 1; i <= 100; i++)
{
pc.Value = i;//使用进度条控制类进行进度更新
pc.Text = i.ToString();
System.Threading.Thread.Sleep(1000);
}
}