zoukankan      html  css  js  c++  java
  • dev的documentManager,多个tab窗体

    private void AddDocument(Funcation CurrentModel)
            {
                if (!string.IsNullOrWhiteSpace(CurrentModel.FunctionKey))
                {
                    //如果旧版本名称与新版本不一样,用‘,’分开
                    var typeFullNames = CurrentModel.FunctionKey.Split(',');
                    foreach (var typeFullName in typeFullNames)
                    {
                        var type = Reflector.Reflect(typeFullName);//反射窗体类型
                        if (type != null)
                        {
                            foreach (BaseDocument fdocument in tabbedView1.Documents)
                            {
                                if (fdocument.Tag == type)
                                {
                                    tabbedView1.Controller.Activate(fdocument);//是否已经打开窗体
                                    return;
                                }
                            }
                            var obj = Activator.CreateInstance((Type)type);
                            Form form = (Form)obj;
                            form.Text = CurrentModel.FunctionName;//窗体
                            tabbedView1.BeginUpdate();//开始加载窗体
                            tabbedView1.Manager.MdiParent = this;
                            BaseDocument document = tabbedView1.AddDocument(form);
                            document.Footer = Directory.GetCurrentDirectory();
                            document.Tag = type;
                            tabbedView1.Controller.Activate(document);
                            tabbedView1.EndUpdate();
                            break;
                        }
                    }
                }
    

    效果如下

    效果如下

    private void AddDocument(Funcation CurrentModel)
            {
                if (!string.IsNullOrWhiteSpace(CurrentModel.FunctionKey))
                {
                    //如果旧版本名称与新版本不一样,用‘,’分开
                    var typeFullNames = CurrentModel.FunctionKey.Split(',');
                    foreach (var typeFullName in typeFullNames)
                    {
                        var type = Reflector.Reflect(typeFullName);//反射窗体类型
                        if (type != null)
                        {
                            foreach (BaseDocument fdocument in tabbedView1.Documents)
                            {
                                if (fdocument.Tag == type)
                                {
                                    tabbedView1.Controller.Activate(fdocument);//是否已经打开窗体
                                    return;
                                }
                            }
                            var obj = Activator.CreateInstance((Type)type);
                            Form form = (Form)obj;
                            form.Text = CurrentModel.FunctionName;//窗体
                            tabbedView1.BeginUpdate();//开始加载窗体
                            tabbedView1.Manager.MdiParent = this;
                            BaseDocument document = tabbedView1.AddDocument(form);
                            document.Footer = Directory.GetCurrentDirectory();
                            document.Tag = type;
                            tabbedView1.Controller.Activate(document);
                            tabbedView1.EndUpdate();
                            break;
                        }
                    }
                }

  • 相关阅读:
    线性筛2 筛约数个数
    背包板子
    线段树(指针板子)
    10.11 模拟赛(QBXT国庆Day3)
    10.6 体育成绩统计
    10.5 T3 DDP BZOJ 4712
    10.2模拟赛总结
    线性筛1
    CF165D Beard Graph
    2019 CSP-S第一轮(hsyz半日游)
  • 原文地址:https://www.cnblogs.com/zeroone/p/8810569.html
Copyright © 2011-2022 走看看