请关闭按钮隐藏而不是关闭 [英] Make close button hide instead of closing
本文介绍了请关闭按钮隐藏而不是关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我怎样才能让一个窗体上的关闭按钮,有效地充当一个隐藏按钮?
How can I make the close button on a form effectively act as a 'Hide' button?
有没有办法中止的FormClosing
事件?
推荐答案
您可以只捕获的FormClosing
事件,并停止默认的动作,然后,而不是关闭窗体只是隐藏:
You could just capture the FormClosing
event and stop the default action, then instead of closing the form just hide it:
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true;
this.Hide();
}
这篇关于请关闭按钮隐藏而不是关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文