winform子窗口关闭后,父窗口重新打开
父窗口 Main
//学生档案管理 private void button1_Click(object sender, EventArgs e) { this.Enabled = false;//当前窗体不可用 StudentInfo si = new StudentInfo(this);//初始化要打开的窗体,Form1为要打开的窗体的类名。 si.ShowDialog();//显示新的窗体。 }
子窗口StudentInfo
public partial class StudentInfo : Form { Main main; public StudentInfo(Main main) { InitializeComponent(); this.main = main; } private void StudentInfo_FormClosed(object sender, FormClosedEventArgs e) { main.Enabled = true; } }