当用户点击窗体上的关闭按钮时,如果不想关闭窗体而是隐藏它,可采用下面的方法。
// 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. }
2023-10-16 14:12:22
当用户点击窗体上的关闭按钮时,如果不想关闭窗体而是隐藏它,可采用下面的方法。
// 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. }