Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一点关于 Application.Run 方法的问题。当我单击 button1 时,可以更改 Application.Run(在默认 Program.cs 文件中)应该将 Application.Run 行更改为例如。
Application.Run(new Form1());
然后按钮2被点击
Application.Run(new Form2());
如果上述情况我们可以在程序仍在运行时进行更改吗?
感谢您的建议!
Application.Run()运行你是程序的主要消息循环。 一旦启动,您将无法对其进行修改。
Application.Run()
相反,您可以简单地Show()创建一个新表单实例,也可以Hide()是旧表单实例。
Show()
Hide()