实现隐藏窗体而非关闭的方法

当用户点击窗体上的关闭按钮时,如果不想关闭窗体而是隐藏它,可采用下面的方法。

// Use this event handler for the FormClosing event.
private void MyForm_FormClosing(object sender, FormClosingEventArgs e)
{
   this.Hide();
   e.Cancel = true; // this cancels the close event.
}
原文地址:https://www.cnblogs.com/xpvincent/p/3611499.html