需要MessageBox返回参数,然后对参数进行判断,如下:(来自MSDN)
if (MessageBox.Show ("Do you want to exit?", "My Application", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Application.Exit(); }
需要MessageBox返回参数,然后对参数进行判断,如下:(来自MSDN)
if (MessageBox.Show ("Do you want to exit?", "My Application", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes) { Application.Exit(); }