📅  最后修改于: 2022-03-11 14:48:56.754000             🧑  作者: Mango
string message = "Do you want to close this window?";
string title = "Close Window";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
DialogResult result = MessageBox.Show(message, title, buttons);
if (result == DialogResult.Yes) {
this.Close();
} else {
// Do something
}