我想首先隐藏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();
}
答案 0 :(得分:1)
试试这个:
frmMasterlistAdministrationAdd frmMasterlistAdministrationAdd = new frmMasterlistAdministrationAdd();
frmMasterlistAdministrationAdd.TopLevel = false;
frmMain frmMain = new frmMain();
frmMasterlistAdministrationAdd.Parent = frmMain;
splitContainer3.Panel2.Controles.add(frmMasterlistAdministrationAdd);
frmMasterlistAdministrationAdd.Show();