예제 #1
0
        private static KryptonPage OpenForm(NodeInfo ninfo)
        {
            if (ninfo.NodeTag == null || ninfo.NodeTag.Equals(string.Empty) || ninfo.NodeTag.Equals("-"))
            {
                MessageBox.Show(string.Format("菜单{0}尚未配置!", ninfo.NodeText), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(null);
            }


            UserControl uc      = new UserControl();
            KryptonPage pageTmp = new KryptonPage();

            uc = System.Activator.CreateInstance(Type.GetType(ninfo.NodeTag)) as UserControl;

            pageTmp.SuspendLayout();
            pageTmp.ClearFlags(KryptonPageFlags.DockingAllowAutoHidden | KryptonPageFlags.DockingAllowDocked);
            pageTmp.TextTitle       = ninfo.NodeText;
            pageTmp.Text            = "分组 " + ninfo.NodeText;
            pageTmp.TextDescription = ninfo.NodeText;
            pageTmp.UniqueName      = ninfo.NodeName;
            if (!ninfo.NodeName.Equals("参数设置"))
            {
                ((UC_GeneFile)uc).LoadConfigFile(ninfo.NodeName);
            }
            else
            {
                ((UC_DataSetting)uc).LoadConfigFile(ninfo.NodeName);
            }
            pageTmp.Controls.Add(uc);
            uc.Dock = DockStyle.Fill;
            pageTmp.ResumeLayout(false);
            pageTmp.PerformLayout();
            _pageDic.Add(pageTmp.UniqueName, pageTmp);
            return(pageTmp);
        }