更新时间:2023-12-06 07:55:04
保护覆盖无效OnFormClosing(FormClosingEventArgs e)
{
if(e.CloseReason == CloseReason.WindowsShutDown)return;
//在此处进行
}
I would like to make X control closing window to hide current display previous form.
In form1 I got:
private void button1_Click(object sender, EventArgs e)
{
Form2 form2 = new Form2();
form2.Tag = this;
form2.Show(this);
Hide();
}
and then when I click X I would like to show previous and hide the current.
You can override OnFormClosing to do this.
protected override void OnFormClosing(FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.WindowsShutDown) return;
// DO WHATEVER HERE
}