DockPanel裏如何在一個子窗體裏打開另一個子窗體 顯示在主窗體中


在主窗體裏設置               
                public   DockPanel   DockPanel
                {
                        get
                        {
                                return   this.dockPanel;
                        }
                }


在要打開新子窗體的子窗體中設置
           
uiConfig   uiCfig   =   new   uiConfig();
if   (((Main_frm)GetTopParent(this)).DockPanel.DocumentStyle   ==   DocumentStyle.SystemMdi)
 {
           uiCfig.MdiParent   =   (Main_frm)GetTopParent(this);
           uiCfig.Show();
}
else
         uiCfig.Show(((Main_frm)GetTopParent(this)).DockPanel);
private Control GetTopParent(Control control)
{
while (control.Parent != null)
{
control = control.Parent;
}
return control;
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章