if(MessageBox.Show("您确定要关闭软件吗?","询问",MessageBoxButtons.YesNo)!=DialogResult.Yes) { return; } 转载于:https://www.cnblogs.com/zhubaoming/p/8484463.html