C窗体程序,怎么做等待处理用的层和进度条

2021-01-26 11:21:45 字数 752 阅读 2154

1楼:迸质弛咽

private void form1_load(object sender, eventargs e)

public void threadfrom()

public void showform()

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++)

thread.sleep(200);

pbprogress.maximum = 0;

pbprogress.visible = false;