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事件
标签:sender,C#,void,object,笔记,DialogResult,Form1,private,Winform 来源: https://www.cnblogs.com/MyVision/p/10991459.html