如何在隐藏时关闭winform [英] How to close a winform when it is hidden

查看:106
本文介绍了如何在隐藏时关闭winform的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我隐藏了一个窗体并打开另一个窗体。



当我回拨第一张表格时,打开了两张这样的表格。



有什么方法可以解决这个问题。

I've hidden a windows form and open another form.

When I called back the first form two such forms are opened.

Is there any way to resolve this problem.

推荐答案

是的。不要创建新表单...

而是在Form1中执行此操作:

Yes. Don't create a new form...
Instead do this in Form1:
Form2 f2 = new Form2();
Hide();
f2.ShowDialog();
Show();

然后当Form2关闭时,Form1将再次显示。

Then when Form2 closes, Form1 will be shown again.


这篇关于如何在隐藏时关闭winform的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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