Пример #1
0
        private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            LibTreeNode node = (LibTreeNode)e.Node;

            if (node.NodeType != NodeType.Class && node.NodeType != NodeType.Func && node.NodeType != NodeType.ReportFunc)
            {
                #region  创建Tabpage
                string tabNm = string.Format("{0}{2}{1}", node.Name, node.NodeType.ToString(), SysConstManage.Underline);
                if (this.libTabControl1.TabPages.ContainsKey(tabNm))
                {
                    this.libTabControl1.SelectedTab = this.libTabControl1.TabPages[tabNm];
                    return;
                }
                TabPage page = new TabPage(string.Format("{0}({1})", node.Text, node.NodeType.ToString()));
                page.Name = tabNm;

                #endregion

                this.libTabControl1.TabPages.Add(page);
                this.libTabControl1.SelectedTab = page;
                switch (node.NodeType)
                {
                case NodeType.DataModel:
                    DataSourceControl dsControl = new DataSourceControl(node);
                    dsControl.Dock = DockStyle.Fill;
                    page.Controls.Add(dsControl);
                    break;

                case NodeType.FormModel:
                    FormTemplate fmControl = new FormTemplate(node);
                    fmControl.Dock = DockStyle.Fill;
                    page.Controls.Add(fmControl);
                    break;

                case NodeType.PermissionModel:
                    PermissionProperty permissionctrl = new PermissionProperty(node.Name);
                    permissionctrl.Dock = DockStyle.Fill;
                    page.Controls.Add(permissionctrl);
                    SDPCRL.COM.ModelManager.LibPermissionSource libpermission = ModelDesignProject.GetLibPermissionById(node.Name);
                    libpermission.Package = node.Package;
                    permissionctrl.SetPropertyValue(libpermission, node);
                    break;

                case NodeType.KeyValues:
                    KeyValuesControl keyvaluectrl = new KeyValuesControl(node);
                    keyvaluectrl.Dock = DockStyle.Fill;
                    page.Controls.Add(keyvaluectrl);
                    break;

                case NodeType.ReportModel:
                    ReportSourceControl reportSourceControl = new ReportSourceControl(node);
                    reportSourceControl.Dock = DockStyle.Fill;
                    page.Controls.Add(reportSourceControl);
                    break;

                case NodeType.TransBillModel:
                    TransSourceControl tranSourceControl = new TransSourceControl(node);
                    tranSourceControl.Dock = DockStyle.Fill;
                    page.Controls.Add(tranSourceControl);
                    break;
                }
            }
        }