在winform程序开发时,当用户点击窗体上的“关闭”按钮时,希望实现退出整个应用程序的功能。我一开始使用如下的代码实现,确认框总要出现两次: private void Form1_FormClosing(object sender, FormClosingEventArgs e) { &nbs…