对了,做一个捕获关闭窗事件,
后,
用Application.Exit();就结束整个程序了,
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
if (MessageBox.Show("确实在退出吗?", "消息", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign) == DialogResult.Yes)
{
Application.Exit();
}
else {
this.Show();
}
}