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

  • 相关阅读:
    echarts的整理
    socket.io做一个简单的聊天案例
    WebSocket通信随笔
    接口返回的二维码图片,如何处理显示(axios处理后台返回图片流格式数据)
    小程序封装request请求
    一站式解决Vue插件开发,上传Github,Npm包发布
    微信公众号链接处理问题
    git常用命令
    vscode 常用配置
    项目中报错Cannot read property 'getAttribute' of undefined解决
  • 原文地址:https://www.cnblogs.com/zeroone/p/8810569.html
Copyright © 2011-2022 走看看