winform将窗体显示到容器中

        
///
///窗体显示到容器中
///
///要显示的窗体对象
privatevoid FromShowDialog(Formfrm)
{
    //窗口置顶
    frm.TopLevel = false;
    //移除Panel容器里所有窗体
    foreach(Control ctl inpanel_right.Controls)
    {
        if (ctl is Form)
        {
           panel_right.Controls.Remove(ctl);
        }
    }
    //设置父容器
    frm.Parent = this.panel_right;
    //窗体无边框
    frm.FormBorderStyle = FormBorderStyle.None;
    //填满父容器
    frm.Dock = DockStyle.Fill;
    frm.Show();
}

分享标题:winform将窗体显示到容器中
当前网址:http://azwzsj.com/article/giedeo.html