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;
                        }
                    }
                }

  • 相关阅读:
    单链表
    队列
    产品经理们,遇到Bug请别十万火急
    2008年7月3日
    JS URL 参数
    NET 产品版权保护方案 (.NET源码加密保护)
    常用正则表达式
    网线接法
    C#创建多文档的界面
    TGE学习笔记04 billboard
  • 原文地址:https://www.cnblogs.com/zeroone/p/8810569.html
Copyright © 2011-2022 走看看