//实例未被创建时加锁(双重锁定,多线程安全) public static Tool2 GetInstance() { if (instance == null || instance.IsDisposed) { lock (syncRoot) { if (instance == null || instance.IsDisposed) { instance = new Tool2(); } } } instance.MdiParent = Form1.ActiveForm; return(instance); }
private void toolStripLabel2_Click(object sender, EventArgs e) { Tool2.GetInstance().Show(); }