private void solingScrew_FormClosing(object sender, FormClosingEventArgs e) { DialogResult res = MessageBox.Show("您确定要退出程序吗?", "退出确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); if (res == DialogResult.OK) { comm.ScomClose(); e.Cancel = false; } else { e.Cancel = true; } }