通常我会做Application.Run(myMainForm)。
但我想做这样的事情:
MyForm1 f = new MyForm1();
f.Close+=OnOpenOverviewWin();
Application.Run(f);
void OnOpenOverviewWin()
{
MyOverViewForm f = new MyOverViewForm ();
Application.Run(f); // i want to do this
Application.NewMainWindow = f; // or something like that
}
答案 0 :(得分:2)
将Application.ShutdownMode属性设置为ShutdownMode.OnLastWindowClose
MyForm1 f = new MyForm1();
f.Close += OnOpenOverviewWin();
Application.ShutdownMode = ShutdownMode.OnLastWindowClose;
Application.Run(f);
void OnOpenOverviewWin()
{
MyOverViewForm f = new MyOverViewForm ();
f.Show();
}