在子传递中声明一个方法设置主窗体要传入的参数,子窗体通过属性传值给主窗体。
主窗体代码片段
FrmBjtx f = new FrmBjtx();
f.Run("挂号报警温馨提示", ksmc, bjs, 15, false,ksdm);
GlobalVariable.isFormActived[ksdm] = true;
窗体代码片段
/// <summary>
/// 运行
/// </summary>
public void Run(string title,string ksmc, int bjs, int zdgbsj,bool gb,string id)
{
_ksmc = ksmc;
_bjs = bjs;
_zdgbsj=zdgbsj;
_gb = gb;
_title = title;
_ksdm = id;
this.Show();
//显示信息
}
private void FrmBjtx_FormClosed(object sender, FormClosedEventArgs e)
{
GlobalVariable.isFormActived.Remove(_ksdm);
} |