• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# TreeNodeCollection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中TreeNodeCollection的典型用法代码示例。如果您正苦于以下问题:C# TreeNodeCollection类的具体用法?C# TreeNodeCollection怎么用?C# TreeNodeCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TreeNodeCollection类属于命名空间,在下文中一共展示了TreeNodeCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetTreeNodes

 protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
 {
     TreeNodeCollection nodes = new TreeNodeCollection();
     TreeNode item = this.CreateTreeNode("-1", "-1", queryStrings, "");
     nodes.Add(item);
     return nodes;
 }
开发者ID:scyllagroup,项目名称:UmbracoFlare,代码行数:7,代码来源:UmbracoFlareTreeController.cs


示例2: GetNodes

        public TreeNodeCollection GetNodes(string node)
        {
            TreeNodeCollection nodes = new TreeNodeCollection(false);

            if (!string.IsNullOrEmpty(node))
            {
                for (int i = 1; i < 6; i++)
                {
                    AsyncTreeNode asyncNode = new AsyncTreeNode();
                    asyncNode.Text = node + i;
                    asyncNode.NodeID = node + i;
                    nodes.Add(asyncNode);
                }

                for (int i = 6; i < 11; i++)
                {
                    TreeNode treeNode = new TreeNode();
                    treeNode.Text = node + i;
                    treeNode.NodeID = node + i;
                    treeNode.Leaf = true;
                    nodes.Add(treeNode);
                }
            }

            return nodes;
        }
开发者ID:pgodwin,项目名称:Ext.net,代码行数:26,代码来源:TreeLoaderService.asmx.cs


示例3: GetTreeNodes

 protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
 {
     var nodes = new TreeNodeCollection();
     var item = this.CreateTreeNode("dashboard", id, queryStrings, "Applicaion Forms", "icon-truck", true);
     nodes.Add(item);
     return nodes;
 }
开发者ID:fraygit,项目名称:iRefundWebsite,代码行数:7,代码来源:ApplicationFormSection.cs


示例4: BindTree

    private void BindTree(TreeNodeCollection Nds, int IDStr)
    {
        SqlConnection Conn = new SqlConnection(ConfigurationManager.AppSettings["SQLConnectionString"].ToString());
        Conn.Open();
        SqlCommand MyCmd = new SqlCommand("select * from ERPBuMen where DirID=" + IDStr.ToString() + " order by ID asc", Conn);
        SqlDataReader MyReader = MyCmd.ExecuteReader();
        while (MyReader.Read())
        {
            TreeNode OrganizationNode = new TreeNode();
            OrganizationNode.Text = MyReader["BuMenName"].ToString();
            OrganizationNode.Value = MyReader["ID"].ToString();
            int strId = int.Parse(MyReader["ID"].ToString());
            OrganizationNode.ImageUrl = "~/images/user_group.gif";
            OrganizationNode.SelectAction =  TreeNodeSelectAction.Expand ;

            string ChildID = ZWL.DBUtility.DbHelperSQL.GetSHSLInt("select top 1 ID from ERPBuMen where DirID=" + MyReader["ID"].ToString() + " order by ID asc");
            if (ChildID.Trim() != "0")
            {
                //需要父项目一起选中,如果父项目不需要的话,请不要注释掉下面的行
                //HaveChild = HaveChild + "|" + MyReader["BuMenName"].ToString() + "|";
            }
            OrganizationNode.ToolTip = MyReader["BuMenName"].ToString();
            OrganizationNode.Expand();
            Nds.Add(OrganizationNode);
            //递归循环
            BindTree(Nds[Nds.Count - 1].ChildNodes, strId);
        }
        MyReader.Close();
        Conn.Close();
    }
开发者ID:cnbin,项目名称:HLB,代码行数:30,代码来源:SelectDanWei.aspx.cs


示例5: GetTreeNodes

        protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
        {
            var collection = new TreeNodeCollection();
            switch (id)
            {
                case "settings":
                    collection.Add(CreateTreeNode("shipping", "settings", queryStrings, "Shipping", "icon-truck", false, "merchello/merchello/Shipping/manage"));
                    collection.Add(CreateTreeNode("taxation", "settings", queryStrings, "Taxation", "icon-piggy-bank", false, "merchello/merchello/Taxation/manage"));
                    collection.Add(CreateTreeNode("payment", "settings", queryStrings, "Payment", "icon-bill-dollar", false, "merchello/merchello/Payment/manage"));
                    collection.Add(CreateTreeNode("notifications", "settings", queryStrings, "Notifications", "icon-chat", false, "merchello/merchello/Notifications/manage"));
                    collection.Add(CreateTreeNode("gateways", "settings", queryStrings, "Gateway Providers", "icon-trafic", false, "merchello/merchello/GatewayProviders/manage"));
                    break;
                case "reports":
                    collection.Add(CreateTreeNode("salesOverTime", "reports", queryStrings, "Sales Over Time", "icon-loading", false, "merchello/merchello/SalesOverTime/manage"));
                    collection.Add(CreateTreeNode("salesByItem", "reports", queryStrings, "Sales By Item", "icon-barcode", false, "merchello/merchello/SalesByItem/manage"));
                    collection.Add(CreateTreeNode("taxesByDestination", "reports", queryStrings, "Taxes By Destination", "icon-piggy-bank", false, "merchello/merchello/TaxesByDestination/manage"));
                    break;
                default:
                    collection.Add(CreateTreeNode("catalog", "", queryStrings, "Catalog", "icon-barcode", false, "merchello/merchello/ProductList/manage"));
                    collection.Add(CreateTreeNode("orders", "", queryStrings, "Orders", "icon-receipt-dollar", false, "merchello/merchello/OrderList/manage"));
                    collection.Add(CreateTreeNode("settings", "", queryStrings, "Settings", "icon-settings", true, "merchello/merchello/Settings/manage"));
                    break;
            }

            return collection;
        }
开发者ID:keba74,项目名称:Merchello,代码行数:26,代码来源:MerchelloTreeController.cs


示例6: RestoreTreeViewState

    private void RestoreTreeViewState(TreeNodeCollection nodes, List<string> list)
    {
        foreach (TreeNode node in nodes)
        {
            //
            // Restore the state of one node.
            //
            if (list.Contains(node.Text))
            {
                if (node.ChildNodes != null && node.ChildNodes.Count != 0 && node.Expanded.HasValue && node.Expanded == false)
                    node.Expand();
            }
            else
            {
                if (node.ChildNodes != null && node.ChildNodes.Count != 0 && node.Expanded.HasValue && node.Expanded == true)
                    node.Collapse();
            }

            //
            // If the node has child nodes, restore their state, too.
            //
            if (node.ChildNodes != null && node.ChildNodes.Count != 0)
                RestoreTreeViewState(node.ChildNodes, list);
        }
    }
开发者ID:trasa,项目名称:presentations,代码行数:25,代码来源:Site.master.cs


示例7: AddNode

   public override TreeNode AddNode(IMaxNode wrapper, TreeNodeCollection parentCol)
   {
      TreeNode tn = base.AddNode(wrapper, parentCol);

      MaterialWrapper mtlWrapper = wrapper as MaterialWrapper;
      if (mtlWrapper != null)
      {
         AddObjects(mtlWrapper, tn.Nodes);
         AddTextureMaps(mtlWrapper, tn.Nodes);

         foreach (IMtl mtl in mtlWrapper.ChildMaterials)
         {
            this.AddNode(mtl, tn.Nodes);
         }
      } 
      else if (!(wrapper is INodeWrapper))
      {
         foreach (IMaxNode node in wrapper.ChildNodes)
         {
            this.AddNode(node, tn.Nodes);
         }
      }

      return tn;
   }
开发者ID:Sugz,项目名称:Outliner-3.0,代码行数:25,代码来源:MaterialMode.cs


示例8: SetSelect

    private bool SetSelect(string strSelected, TreeNodeCollection nodes)
    {
        if (nodes != null
            && nodes.Count > 0
            )
        {
            foreach (TreeNode node in nodes)
            {
                if (node != null
                    )
                {
                    if (
                        !PubClass.IsNull(node.Value)
                        && node.Value == strSelected
                        )
                    {
                        node.Select();
                        return true;
                    }
                    else if (node.ChildNodes != null
                        && node.ChildNodes.Count > 0
                        )
                    {
                        bool success = SetSelect(strSelected, node.ChildNodes);

                        // 如果成功了,就不往下继续查找了;
                        if (success)
                            return true;
                    }
                }
            }
        }
        return false;
    }
开发者ID:stableboy,项目名称:XinBaoBei,代码行数:34,代码来源:SubjectivityQuestion.aspx.cs


示例9: ChoiceTreeNode

 /// <summary>
 /// 
 /// </summary>
 /// <param name="tnc"></param>
 protected void ChoiceTreeNode(TreeNodeCollection tnc,List<RoleMoudleInfo> info)
 {
     foreach (TreeNode node in tnc)
     {
         RoleMoudleInfo Info = info.Find(delegate(RoleMoudleInfo info1)
         {
             return info1.MoudleId == int.Parse(node.Value);
         });
         if (node.ChildNodes.Count != 0)
         {
             if (Info!=null)
             {
                 node.Checked = true;
             }
             ChoiceTreeNode(node.ChildNodes, info);
         }
         else
         {
             if (Info != null)
             {
                 node.Checked = true;
             }
         }
     }
 }
开发者ID:qq5013,项目名称:JXNG,代码行数:29,代码来源:GrantMoudle.aspx.cs


示例10: BindBuMenTree

    public void BindBuMenTree(TreeNodeCollection Nds, int IDStr)
    {
        DataSet MYDT=ZWL.DBUtility.DbHelperSQL.GetDataSet("select * from ERPBuMen where DirID=" + IDStr.ToString() + " order by ID asc");
        for(int i=0;i<MYDT.Tables[0].Rows.Count;i++)
        {
            TreeNode OrganizationNode = new TreeNode();
            string CharManStr = "";
            if (MYDT.Tables[0].Rows[i]["ChargeMan"].ToString().Trim().Length <= 0)
            {
                CharManStr = "<font color=\"Red\">[未设置负责人]</font>";
            }
            else
            {
                CharManStr = MYDT.Tables[0].Rows[i]["ChargeMan"].ToString().Trim();
            }

            OrganizationNode.Text = MYDT.Tables[0].Rows[i]["BuMenName"].ToString() + "&nbsp;部门主管:" + CharManStr;
            OrganizationNode.ToolTip = "部门主管:" + MYDT.Tables[0].Rows[i]["ChargeMan"].ToString() + "\n电话:" + MYDT.Tables[0].Rows[i]["TelStr"].ToString() + "\n传真:" + MYDT.Tables[0].Rows[i]["ChuanZhen"].ToString() + "\n备注:" + MYDT.Tables[0].Rows[i]["BackInfo"].ToString();

            OrganizationNode.Value = MYDT.Tables[0].Rows[i]["ID"].ToString();
            int strId = int.Parse(MYDT.Tables[0].Rows[i]["ID"].ToString());
            OrganizationNode.ImageUrl = "~/images/user_group.gif";
            OrganizationNode.SelectAction = TreeNodeSelectAction.Expand;

            OrganizationNode.Expand();
            Nds.Add(OrganizationNode);
            //递归循环
            BindBuMenTree(Nds[Nds.Count - 1].ChildNodes, strId);
        }
    }
开发者ID:cnbin,项目名称:HLB,代码行数:30,代码来源:BuMenInfoSerch.aspx.cs


示例11: PerformGetTreeNodes

 /// <summary>
 /// Gets the tree nodes for the given id
 /// </summary>
 /// <param name="id"></param>
 /// <param name="queryStrings"></param>
 /// <returns></returns>
 /// <remarks>
 /// If the content item is a container node then we will not return anything
 /// </remarks>
 protected override TreeNodeCollection PerformGetTreeNodes(string id, FormDataCollection queryStrings)
 {
     var nodes = new TreeNodeCollection();
     var entities = GetChildEntities(id);
     nodes.AddRange(entities.Select(entity => GetSingleTreeNode(entity, id, queryStrings)).Where(node => node != null));            
     return nodes;
 }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:16,代码来源:ContentTreeController.cs


示例12: BuildFirstLevel

        public static TreeNodeCollection BuildFirstLevel()
        {
            string path = HttpContext.Current.Server.MapPath("~/Examples/");
            DirectoryInfo root = new DirectoryInfo(path);
            DirectoryInfo[] folders = root.GetDirectories();
            folders = SortFolders(root, folders);

            TreeNodeCollection nodes = new TreeNodeCollection(false);

            foreach (DirectoryInfo folder in folders)
            {
                if ((folder.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden ||
                    excludeList.Contains(folder.Name) || folder.Name.StartsWith("_"))
                {
                    continue;
                }

                ExampleConfig cfg = new ExampleConfig(folder.FullName + "\\config.xml", false);

                string iconCls = string.IsNullOrEmpty(cfg.IconCls) ? "" : cfg.IconCls;
                AsyncTreeNode node = new AsyncTreeNode();

                node.Text = MarkNew(folder.FullName, folder.Name.Replace("_", " "));
                node.IconCls = iconCls;
                string url = PhysicalToVirtual(folder.FullName + "/");
                node.NodeID = "e" + Math.Abs(url.ToLower().GetHashCode());

                nodes.Add(node);
            }

            return nodes;
        }
开发者ID:pgodwin,项目名称:Ext.net,代码行数:32,代码来源:UIHelpers.cs


示例13: GetTreeNodes

        protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
        {
            if (id == "-1")
            {
                var nodes = new TreeNodeCollection();

                var allContacts = this.CreateTreeNode("dashboard", id, queryStrings, "All Contact Message", "icon-list", false);
                var repliedContacts = this.CreateTreeNode("replied", id, queryStrings, "Replied Contact Message", "icon-check", false);
                var unRepliedContacts = this.CreateTreeNode("unreplied", id, queryStrings, "Un-Replied Contact Message", "icon-time", false);
                var spamContacts = this.CreateTreeNode("spam", id, queryStrings, "Spam", "icon-squiggly-line", false);
                var trashedContacts = this.CreateTreeNode("deleted", id, queryStrings, "Deleted", "icon-trash", false);
                var settingsContacts = this.CreateTreeNode("settings", id, queryStrings, "Settings", "icon-wrench", false);

                repliedContacts.RoutePath = "/uContactor/uContactorSection/replied/0";
                unRepliedContacts.RoutePath = "/uContactor/uContactorSection/unreplied/0";
                spamContacts.RoutePath = "/uContactor/uContactorSection/spam/0";
                trashedContacts.RoutePath = "/uContactor/uContactorSection/deleted/0";
                settingsContacts.RoutePath = "/uContactor/uContactorSection/settings/0";

                nodes.Add(allContacts);
                nodes.Add(repliedContacts);
                nodes.Add(unRepliedContacts);
                nodes.Add(spamContacts);
                nodes.Add(trashedContacts);
                nodes.Add(settingsContacts);

                return nodes;
            }

            throw new NotImplementedException();
        }
开发者ID:alanmac,项目名称:uContactor,代码行数:31,代码来源:uContactorController.cs


示例14: ReadNodes

        private void ReadNodes( string path, TreeNodeCollection nodes, string selectedPath )
        {
            foreach( TreeNode node in nodes )
            {
                string childPath = path + "/" + GetNodeText( node ).Replace( '/', '_' );
                bool expand = ControlPreferences.GetValue( Name, childPath ) == "Expanded";
                bool collapse = ControlPreferences.GetValue( Name, childPath ) == "Collapsed";
                bool select = (childPath == selectedPath);

                if( expand )
                {
                    _treeControl.ExpandNode( node );

                    ReadNodes( childPath, node.ChildNodes, selectedPath );
                }
                else if( collapse )
                {
                    _treeControl.CollapseNode( node );
                }
                if( select )
                {
                    _treeControl.SelectedNode = node;
                }
            }
        }
开发者ID:CecleCW,项目名称:ProductMan,代码行数:25,代码来源:TreeControlWatch.cs


示例15: GetTreeNodes

        /// <summary>
        /// Returns all section tree nodes
        /// </summary>
        /// <param name="id">Node's id.</param>
        /// <param name="queryStrings">Query strings</param>
        /// <returns>Collection of tree nodes</returns>
        protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
        {
            var nodes = new TreeNodeCollection();
            var ctrl = new WebsiteApiController();            

            if (id == Constants.System.Root.ToInvariantString())
            {
                var item = CreateTreeNode("0", "-1", queryStrings, "Websites", "icon-folder", true);
                nodes.Add(item);
                
                return nodes;
            }
            else if (id == "0")
            {
                foreach (var website in ctrl.GetAll())
                {
                    var node = CreateTreeNode(
                        website.Id.ToString(),
                        "0",
                        queryStrings,
                        website.ToString(),
                        "icon-document",
                        false);
                    
                    nodes.Add(node);
                }

                return nodes;
            }
            throw new NotSupportedException();
        }
开发者ID:WebCentrum,项目名称:WebPackUI,代码行数:37,代码来源:WebpackTreeController.cs


示例16: ProcessRequest

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            string nodeId = context.Request["node"];

            if (!string.IsNullOrEmpty(nodeId))
            {
                TreeNodeCollection nodes = new TreeNodeCollection(false);

                for (int i = 1; i < 6; i++)
                {
                    AsyncTreeNode asyncNode = new AsyncTreeNode();
                    asyncNode.Text = nodeId + i;
                    asyncNode.NodeID = nodeId + i;
                    nodes.Add(asyncNode);
                }

                for (int i = 6; i < 11; i++)
                {
                    TreeNode node = new TreeNode();
                    node.Text = nodeId + i;
                    node.NodeID = nodeId + i;
                    node.Leaf = true;
                    nodes.Add(node);
                }

                context.Response.Write(nodes.ToJson());
                context.Response.End();
            }
        }
开发者ID:pgodwin,项目名称:Ext.net,代码行数:30,代码来源:TreeLoader.ashx.cs


示例17: GetTreeNodes

    protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
    {
        if (id == Constants.System.Root.ToInvariantString())
        {
            var ctrl = new ClientApiController();
            var nodes = new TreeNodeCollection();

            foreach (var client in ctrl.GetAll())
            {
                var node = CreateTreeNode(
                    client.Id.ToString(),
                    "-1",
                    queryStrings,
                    client.ToString(),
                    "icon-user",
                    false);

                nodes.Add(node);
            }

            return nodes;
        }

        throw new NotSupportedException();
    }
开发者ID:Zeturas,项目名称:umbraco_ticketsystem,代码行数:25,代码来源:ClientsTreeController.cs


示例18: OnActionExecuted

        /// <summary>
        /// Called by the ASP.NET MVC framework after the action method executes.
        /// </summary>
        /// <param name="filterContext">The filter context.</param>
        public override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            base.OnActionExecuted(filterContext);

            if (filterContext.Result is RebelTreeResult)
            {
                var treeResult = (RebelTreeResult)filterContext.Result;

                var nodeCollection = new TreeNodeCollection();
                nodeCollection.AddRange(treeResult.NodeCollection);

                foreach (var node in nodeCollection)
                {
                    var menuActions = node.MenuActions.ToList();
                    foreach (var menuAction in menuActions)
                    {
                        var attributes = menuAction.Metadata.ComponentType.GetCustomAttributes(typeof(RebelAuthorizeAttribute), true);
                        if (attributes.Length > 0)
                        {
                            var authorized = attributes.Aggregate(false, (current, attribute) => current || ((RebelAuthorizeAttribute)attribute).IsAuthorized(filterContext.HttpContext, node.HiveId));
                            if (!authorized)
                                node.MenuActions.Remove(menuAction);
                        }
                    }
                }

                filterContext.Result = new RebelTreeResult(nodeCollection, filterContext.Controller.ControllerContext);
            }
        }
开发者ID:RebelCMS,项目名称:rebelcmsxu5,代码行数:33,代码来源:MenuItemsPermissionFilterAttribute.cs


示例19: GetTreeNodes

        protected override Umbraco.Web.Models.Trees.TreeNodeCollection GetTreeNodes(string id, System.Net.Http.Formatting.FormDataCollection queryStrings)
        {
            //check if we're rendering the root node's children
            if (id == Constants.System.Root.ToInvariantString())
            {
                var ctrl = new PersonApiController();
                var nodes = new TreeNodeCollection();

                foreach (var person in ctrl.GetAll())
                {
                    var node = CreateTreeNode(
                        person.Id.ToString(),
                        "-1",
                        queryStrings,
                        person.ToString(),
                        "icon-user",
                        false);

                    nodes.Add(node);

                }
                return nodes;
            }

            //this tree doesn't suport rendering more than 1 level
            throw new NotSupportedException();
        }
开发者ID:bashenandi,项目名称:UmbracoAngularBackofficePages,代码行数:27,代码来源:PeopleTreeController.cs


示例20: AddFiles

        private TreeNodeCollection AddFiles(string folder, FormDataCollection queryStrings)
        {
            var pickerApiController = new FileSystemPickerApiController();
            //var str = queryStrings.Get("startfolder");

            if (string.IsNullOrWhiteSpace(folder))
                return null;

            var filter = queryStrings.Get("filter").Split(',').Select(a => a.Trim().EnsureStartsWith(".")).ToArray();

            var path = IOHelper.MapPath(folder);
            var rootPath = IOHelper.MapPath(queryStrings.Get("startfolder"));
            var treeNodeCollection = new TreeNodeCollection();

            foreach (FileInfo file in pickerApiController.GetFiles(folder, filter))
            {
                string nodeTitle = file.Name;
                string filePath = file.FullName.Replace(rootPath, "").Replace("\\", "/");

                //if (file.Extension.ToLower() == ".gif" || file.Extension.ToLower() == ".jpg" || file.Extension.ToLower() == ".png")
                //{
                //    nodeTitle += "<div><img src=\"/umbraco/backoffice/FileSystemPicker/FileSystemThumbnailApi/GetThumbnail?width=150&imagePath="+ HttpUtility.UrlPathEncode(filePath) +"\" /></div>";
                //}

                TreeNode treeNode = CreateTreeNode(filePath, path, queryStrings, nodeTitle, "icon-document", false);
                treeNodeCollection.Add(treeNode);
            }

            return treeNodeCollection;
        }
开发者ID:scyllagroup,项目名称:UmbracoFlare,代码行数:30,代码来源:FolderSystemTreeController.cs



注:本文中的TreeNodeCollection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TreeOffset类代码示例发布时间:2022-05-24
下一篇:
C# TreeNodeAdvMouseEventArgs类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap