本文整理汇总了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);
}
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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];
}