110,533
社区成员
发帖
与我相关
我的任务
分享
//子线程中
public delegate void ProgreccBarHandler(int value, string strInfor); //定义委托显示进度条的信息
public ProgreccBarHandler SetProBar; //显示进度条的信息
//设置状态栏
if (this.SetProBar != null)
SetProBar(90, "Information");
//主界面中(myManager为线程实例)
this.myManager.SetProBar = this.SetProgreccBar; //显示进度条信息
/// <summary>
/// 显示线程回传的进度条的信息
/// </summary>
/// <param name="value">进度条的当前值</param>
/// <param name="strInfor">当前提示信息</param>
public void SetProgreccBar(int value, string strInfor)
{
if (this.InvokeRequired)
{
try
{
this.Invoke(new MessageHandler(SetProgreccBar),
new object[] { value, strInfor });
}
catch(Exception e)
{
Console.WriteLine(e.Source + " " + e.Message);
}
}
else
{
this.tlProBar.Value = value; //设置滚动条
this.tlLabInfor.Text = strInfor; //设置提示信息
this.staStr.Refresh(); //刷新状态栏
}
}