private void btnAnalyze_Click(object sender, EventArgs e)
{
if (treeList1.Nodes.Count < 2)
{
XtraMessageBox.Show("请选择至少两个节点!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
labelControl1.Visible = true;
labelControl1.Text = "正在进行分析....";
labelControl1.Refresh();
length = 0.0;
Thread thread = new Thread(new ThreadStart(Change));
thread.Start();
}
delegate void LabelChange();//如果需要传参数就在这里加参数
void Change()
{
if (labelControl1.InvokeRequired)
{
LabelChange label = new LabelChange(Change);
this.Invoke(label);如果传参数this.Invoke(label,x,x,x)
}
else
{
Run();
}
}
void Run()
{
。。。。。
}