创建窗体委托函数
public delegate void setShowChartFormInvoke(Form subform);
public void setShowChartForm(Form subform)
{
if (this.InvokeRequired)
{
setShowChartFormInvoke _setShowChartFormInvoke = new setShowChartFormInvoke(setShowChartForm);
this.Invoke(_setShowChartFormInvoke, new object[] { subform });
}
else
{
subform.StartPosition = FormStartPosition.CenterParent;//新窗口显示在主窗口中间
subform.ShowDialog();//新窗口以对话框模式显示
}
}
在子线程里调用时
this.setShowChartForm(Form subform);