110,578
社区成员
发帖
与我相关
我的任务
分享
//主窗口类
SolutionRobot MyRobot = new SolutionRobot(textBoxOfInputPath.Text, textBoxOfOutputPath.Text,day);
WatingForm wait = new WatingForm();
MyRobot.Run();
wait.CloseDialog();
...
//弹出窗口类
partial class WatingForm : Form
{
public WatingForm()
{
InitializeComponent();
this.ShowDialog();
//OperateProgressBar();
}
public void CloseDialog()
{
this.Close();
}
using System.Threading;
Thread t = new Thread(new ThreadStart(ShowProgressBar));
t.Start();
try
{
//这里是你的计算过程
}
finally
{
bAbort = true;
t.Join();
}
static bool bAbort = false;
private static void ShowProgressBar()
{
ProgressForm prgForm = new ProgressForm();
aForm.Show();
while (!bAbort || prgForm .progressBar1.Value < 99)
{
if (prgForm .progressBar1.Value + 3 > 100)
{
prgForm .progressBar1.Value = 1;
}
else
{
prgForm .progressBar1.Value += 3;
}
Thread.Sleep(5);
}
}