实现效果:

知识运用:
MessageBox类的Show方法 //在窗体中弹出对话框 并根据用户的选择返回结果
public DialogResult Show (IWin32Window owner,string text) //窗体对象 字符串对象 返回DialogResult枚举值
和Application类的Exit方法 //关闭所有应用程序窗口
public static void Exit()
实现代码:
private void btn_show_Click(object sender, EventArgs e)
{
DialogResult result= MessageBox.Show(this
,"你确定要推出吗?","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
if (result== DialogResult.OK)
Application.Exit();
}
浙公网安备 33010602011771号