我有一个主窗口,它使用以下方法打开子窗口:
this.Hide();
this.ShowInTaskbar = false;
login = new frmLogin(this);
login.Closed += (s, args) => this.Close();
login.Show();
这样做很好,子窗口是打开的,如果用户单击X按钮,两个窗口都关闭。
但是,该窗口中有一个按钮来执行任务,如果成功,则必须重新打开主窗口并关闭子窗口:
// main is reference to main window, this. is the sub window
main.ShowInTa