C# MDI Parent detect when MDI Child is closing?

前端 未结 6 1190
青春惊慌失措
青春惊慌失措 2021-01-18 10:18

I\'m attempting to detect, on the MDI parent, when my MDI child form closes, and react accordingly. The MDI parent shouldn\'t do anything until the MDI child closes. Here is

6条回答
  •  既然无缘
    2021-01-18 10:56

    On mdiparent make a public function

    public void MakeMenuVisible()
    {
    MainMenu.visible = true;
    }
    

    Then on childform you can run the function like this

    private void ChildForm_FormClosed(object sender, FormClosedEventArgs e)
    {
    //Cast MdiParent to Mainform
    ((mainform)this.MdiParent).MakeMenuVisible();  
    }
    

提交回复
热议问题