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

  • 相关阅读:
    IDA*算法
    智能指针
    C51模拟I2C,音乐播放(记忆)
    类与对象解剖(虚函数)
    MFC类层次结构
    平面几何
    IDAstar搜索
    MFC程序初始化过程
    放苹果 分治法
    【读后感】编程珠玑 第九章 代码调优
  • 原文地址:https://www.cnblogs.com/zeroone/p/8810569.html
Copyright © 2011-2022 走看看