2

我想先隐藏 childform(frmMenuMasterlist) 然后将 childform(frmMasterlistAdministrationAdd) 显示给 MDI 父级 (frmMain.splitcontainer.panel2)。当按钮像 web 中的母版页一样在父窗体上时它工作正常,但是当我把它放在子窗体中时,只有 this.hide() 执行。任何人都可以在这种情况下帮助我。提前谢谢了

private void btn_Administration_Click(object sender, EventArgs e)
    {
        this.Hide();
        frmMasterlistAdministrationAdd frmMasterlistAdministrationAdd = new frmMasterlistAdministrationAdd();
        frmMasterlistAdministrationAdd.TopLevel = false;
        frmMain frmMain = new frmMain();
        frmMasterlistAdministrationAdd.Parent = frmMain.splitContainer3.Panel2;
        frmMasterlistAdministrationAdd.Show();
    }
4

1 回答 1

1

试试这个:

frmMasterlistAdministrationAdd frmMasterlistAdministrationAdd = new frmMasterlistAdministrationAdd();
    frmMasterlistAdministrationAdd.TopLevel = false;
    frmMain frmMain = new frmMain();
    frmMasterlistAdministrationAdd.Parent = frmMain;
    splitContainer3.Panel2.Controles.add(frmMasterlistAdministrationAdd);
    frmMasterlistAdministrationAdd.Show();
于 2013-03-28T03:59:48.583 回答