当窗体关闭行动 [英] Action when form is closed

查看:108
本文介绍了当窗体关闭行动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何让尽可能通过按关闭按钮,使这样的形式没有关闭,它被关掉?

How to make as by pressing to the close button, make so that the form was not closed, and it was turned off?

private void Form1_Closed(object sender, EventArgs e)
{
    Form1.Hide();
}



所以,形式都是一样关闭。

So the form is all the same closed.

推荐答案

您应该做它的FormClosing不FormClosed事件是这样的:

You should do it on FormClosing not FormClosed event like this:

private void Form1_FormClosing(object sender, EventArgs e) {
    Form1.Hide();
    e.Cancel = true;
}



FormClosed表示形式已经被关闭。

FormClosed means the form is already closed.

这篇关于当窗体关闭行动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆