方法一: 修改子窗体中自动生成的Dispose方法(在Form.Designer.cs文件中)
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
//if (disposing && (components != null))
//{
// components.Dispose();
//}
//base.Dispose(disposing);
Hide();
}
方法二:添加子窗体FormClosing事件处理方法
private void form***_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true; //取消该事件响应 this.Visible = false; //隐藏
}