//打开服务器端的界面 private void btn_Server_Click(object sender, EventArgs e) { if (server == null) { server = new Frm_Server(); server.Show(); //子窗口关闭后释放实例 server.FormClosing += ReleaseObjct_Server; } else { server.Activate(); } }
private void ReleaseObjct_Server(object sender, FormClosingEventArgs e) { //释放实例 server = null; }