Winform 关闭窗口时提示信息

protected override void OnClosing(CancelEventArgs e)
                {
                         //退出提示,真的要退出,才允许退出
                         if (MessageBox.Show( this, "你真的要退出?", "提示",
                                                                MessageBoxButtons.YesNo,
                                                                MessageBoxIcon.Question) == DialogResult.No)
                        {
                                e.Cancel = true;
                        }
                }

你可能感兴趣的:(职场,关闭窗口,WinForm,休闲)