//创建撕裂检测界面 private void btn_Tear_Click(object sender, EventArgs e) { //判断子窗口是否有实例 if (tearFrm == null) { tearFrm = new TearFrm(); tearFrm.Show(); //子窗口关闭后增加释放实例的功能 tearFrm.FormClosing += ReleaseObjct_Tear; } else { //存在子窗口打开的时候,重新选择打开的子窗口 tearFrm.Activate(); } }
//释放撕裂界面示例事件 private void ReleaseObjct_Tear(object sender, FormClosingEventArgs e) { //释放实例 tearFrm = null; }