嵌入窗体显示
#region 嵌入窗体显示
private void OpenForm(Form form)
{
ClosePreForm();
form.TopLevel = false;//关闭前面的窗体
form.FormBorderStyle = FormBorderStyle.None;//将子窗体设置成非顶级控件
form.Parent = splitContainer.Panel2;//去掉子窗体的边框
form.Dock = DockStyle.Fill;//随着容器大小自动调整窗体大小
}
//关闭嵌入的窗体
private void ClosePreForm()
{
foreach (Control item in splitContainer.Panel2.Controls)
{
if (item is Form)
{
Form objControl = (Form)item;
objControl.Close();
}
}
}