C#Winform学习笔记

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
DialogResult result = MessageBox.Show("确认要退出吗?", "信息提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);

if (result==DialogResult.Cancel)
{
e.Cancel = true;
}
}

private void tsbExit_Click(object sender, EventArgs e)
{
this.Close();
}

private void button1_Click(object sender, EventArgs e)
{
this.Close();
}

private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
MessageBox.Show("China");
}
}
}

//当前窗体的退出this.close()都会执行 formClosing 事件,和formClosed事件

C#Winform学习笔记

上一篇:【win10激活问题】 从【win10专业工作站版】转为 数字许可证的【win10专业版】


下一篇:windows10 设置 socks5 代理