如何关闭特定窗口? [英] How do I close a specific window?

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

问题描述

我有三个窗口,当我关闭其中一个时,我希望主窗口也关闭,

但不是最后一个。我怎么能这样做?

I have three windows and when i close one of them, I want the main window to close too,
but not the last one. How can i do that?

推荐答案

如果通过主窗口指的是启动应用程序的表单,则无法关闭它。关闭启动窗口将关闭整个应用程序。



您可以 .Hide()启动窗口。



那么问题是什么?您可以 myWindowName .Dispose()您的其他表格如果您不需要它们或 myWindowName .Hide()如果你想在不修改内容的情况下取回它们。
If by "main window" you're referring to the form that start your application, you cannot close it. Closing your startup window will close your entire application.

You can .Hide() the startup window.

So what's the problem?? You can myWindowName.Dispose() your other forms if you don't need them or myWindowName.Hide() them if you want to get them back without modifying their contents.


这篇关于如何关闭特定窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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