在 Windows 表单应用程序中,如何只关闭第一个表单?

In a Windows Forms application, how to only close the first form?

我的 Windows 表单应用程序有一个奇怪的问题。我打开了多个表单,每个表单对应一个文件。当我关闭第一个时,所有其他的也关闭并且程序退出。但是,当关闭其中一个其他表单时,我没有遇到这种行为。

搜索此内容时,我在 MSDN 上找到了 this article,但它对我没有帮助。

那么,我该怎么做呢?

您需要将关机模式更改为 When Last form closes 而不是 When Startup form closes

您可以在以下位置找到此设置:

Project properties>Application Tab>Windows Application framework properties>Shutdown mode

这些设置应该是一目了然的