当前位置: 首页>>代码示例>>C#>>正文


C# TreeNodeCollection.Find方法代码示例

本文整理汇总了C#中System.Windows.Forms.TreeNodeCollection.Find方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNodeCollection.Find方法的具体用法?C# TreeNodeCollection.Find怎么用?C# TreeNodeCollection.Find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.TreeNodeCollection的用法示例。


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

示例1: BuildTree

        private void BuildTree(DirectoryInfo directoryInfo, TreeNodeCollection addInMe)
        {
            TreeNode curNode = null;
            if (addInMe.ContainsKey(directoryInfo.FullName) == false)
                curNode = addInMe.Add(directoryInfo.FullName, directoryInfo.Name);
            else
                curNode = addInMe.Find(directoryInfo.FullName, false)[0];

            foreach (FileInfo file in directoryInfo.GetFiles())
            {
                if (curNode.Nodes.ContainsKey(file.FullName) == false)
                {
                    curNode.Nodes.Add(file.FullName, file.Name);
                }
            }
            foreach (DirectoryInfo subdir in directoryInfo.GetDirectories())
            {
                BuildTree(subdir, curNode.Nodes);
            }
        }
开发者ID:nian0601,项目名称:Spaceshooter,代码行数:20,代码来源:Form1.cs

示例2: macroPlaySelectNode

        private TreeNode macroPlaySelectNode(string method, TreeNodeCollection trc, TreeView view)
        {
            int c = method.IndexOf('\'');
            if (c > 0)
            {
                string m = method.Substring(c + 1);
                method = method.Substring(0, c);
                c = Int32.Parse(m);
            }
            else
            {
                c = 1;
            }

            TreeNode[] tns = trc.Find(method, true);
            if (tns.Length > 0)
            {
                view.SelectedNode = tns[c - 1];
                return view.SelectedNode;
            }
            return null;
        }
开发者ID:hdougie,项目名称:webservicestudio2,代码行数:22,代码来源:NewMainForm.Macro.cs

示例3: InsertTreeNode

            private void InsertTreeNode(NavigatorPage page, TreeNodeCollection treeNodes, int depth, Dictionary<NavigatorPage, TreeNode> pageMap)
            {
                PathSegment segment = page.Path.Segments[depth];

                // see if node for this segment already exists
                TreeNode treeNode = CollectionUtils.FirstElement(treeNodes.Find(segment.LocalizedText, false));
                if (treeNode == null)
                {
                    // need to create the node, however, we can't just add it to the end of the child collection,
                    // we need to insert it at the appropriate place, which is just after the last "visited" node
                    // find first unvisited node, which indicates the insertion point
                    int i = 0;
                    for (; i < treeNodes.Count; i++)
                    {
                        if (!_visitedNodes.Contains(treeNodes[i]))
                            break;
                    }

                    // insert new node
                    treeNode = treeNodes.Insert(i, segment.LocalizedText, segment.LocalizedText);
                }

                if (depth < page.Path.Segments.Count - 1)
                {
                    // recur on next path segment
                    InsertTreeNode(page, treeNode.Nodes, depth + 1, pageMap);
                }
                else
                {
                    // this is the last path segment
                    treeNode.Tag = page;
                    pageMap.Add(page, treeNode);
                }

                // remember that this node has now been "visited"
                _visitedNodes.Add(treeNode);

            }
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:38,代码来源:NavigatorComponentContainerControl.cs

示例4: FindUserObjectTagFromTreeNodes

        public static UserObject FindUserObjectTagFromTreeNodes(TreeNodeCollection nodeCollection, string findId) {
            TreeNode[] nodes = nodeCollection.Find(findId, true);

            foreach (TreeNode node in nodes) {
                UserObject userObj = (UserObject)node.Tag;
                if (userObj == null)
                    continue;
                if (userObj.Id == findId) {
                    return userObj;
                }
            }
            return null;
        }
开发者ID:WeDoCrm,项目名称:client_product2.0,代码行数:13,代码来源:Utils.cs

示例5: FindMemberObjTagFromTreeNodes

        public static MemberObj FindMemberObjTagFromTreeNodes(TreeNodeCollection nodeCollection, string findId) {
            TreeNode[] nodes = nodeCollection.Find(findId, true);

            foreach (TreeNode node in nodes) {
                MemberObj userObj = (MemberObj)node.Tag;
                if (userObj == null)
                    continue;
                if (userObj.Id == findId) {
                    return userObj;
                }
            }
            return null;
        }
开发者ID:WeDoCrm,项目名称:WeDoMessenger2.0,代码行数:13,代码来源:ChatUtils.cs

示例6: AddPathToTree

        // Ported from 'http://tinyurl.com/pgsadpk'
        private TreeNode AddPathToTree(TreeNodeCollection nodes, string path)
        {
            var fname = Path.GetFileName(path);

            if (path != fname)
                nodes = AddPathToTree(nodes, Path.GetDirectoryName(path)).Nodes;

            var node = nodes.Find(fname, false).FirstOrDefault();

            if (node == null)
                node = nodes.Add(fname, fname);

            return node;
        }
开发者ID:darkalemanbr,项目名称:MagmaGrimDawnToolkit,代码行数:15,代码来源:MainForm.cs

示例7: AddNode

		static public TreeNode AddNode( TreeNodeCollection Tree, string Text )
		{
			TreeNode[] Childs = Tree.Find( Text, false );

			TreeNode Child = null;

			if ( Childs == null || Childs.Length == 0 )
			{
				Child = Tree.Add( Text );
				Child.Name = Text;
			}
			else
			{
				Child = Childs[0];
			}

			return Child;
		}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:18,代码来源:Tokens.cs

示例8: GetParentSelectedNode

        /// <summary>
        /// 获得选中的节点
        /// </summary>
        /// <param name="treeNodeCollection"></param>
        /// <param name="guid"></param>
        /// <returns></returns>
        public TreeNode GetParentSelectedNode(TreeNodeCollection treeNodeCollection, Guid guid)
        {
            Model.CustomerGroup model = GetModel(guid);

            return (treeNodeCollection.Find(model.parentGUID.ToString(), true))[0];
        }
开发者ID:hubuUniversity,项目名称:demo,代码行数:12,代码来源:CustomerGroup.cs


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