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事件

上一篇:2020-11-27


下一篇:ORA-01148:cannot refresh file size for datafile ***