C#中,怎样使用进度条,当打开程序时显示程序打开进度。
2个回答
展开全部
ProcessBar控件,可以用时间作为参数传给
Datetime startTime=你开始加载窗体的时间;
DateTime endTime = DateTime.Now;
TimeSpan ts = endTime - startTime;
int time = int.Parse(ts.Milliseconds.ToString());
//MessageBox.Show(time.ToString());
pbProgress.Minimum = 20;
pbProgress.Maximum = int.Parse((time * 1000).ToString());
pbProgress.Step = 1;
for (int i = 0; i <= pbProgress.Maximum; i++)
{
pbProgress.PerformStep();
}
Thread.Sleep(200);
pbProgress.Maximum = 0;
pbProgress.Visible = false;
Datetime startTime=你开始加载窗体的时间;
DateTime endTime = DateTime.Now;
TimeSpan ts = endTime - startTime;
int time = int.Parse(ts.Milliseconds.ToString());
//MessageBox.Show(time.ToString());
pbProgress.Minimum = 20;
pbProgress.Maximum = int.Parse((time * 1000).ToString());
pbProgress.Step = 1;
for (int i = 0; i <= pbProgress.Maximum; i++)
{
pbProgress.PerformStep();
}
Thread.Sleep(200);
pbProgress.Maximum = 0;
pbProgress.Visible = false;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询