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

  • 相关阅读:
    void型指针转换。
    MSSQL数据库中记录生日与输入的年龄,进行比对
    [转][C#]内置的 DateTime 用法
    Asp.Net 文件操作基类(读取,删除,批量拷贝,删除,写入,获取文件夹大小,文件属性,遍历目录)
    点击Repeater中的按钮,获取Repeater中TextBox中的值
    [转]UrlReWriter 使用经验小结收藏
    C#中实现VB.net中ReDim功能
    在存储过程中循环表中的记录集
    ADO.net取存储过程的返回值以及存储过程中Return和OUTPUT的区别
    部分FCKeditor常用JS函数
  • 原文地址:https://www.cnblogs.com/zeroone/p/8810569.html
Copyright © 2020-2023  润新知