소리소문 없이... 사랑도 명예도 이름도 남김 없이...
DexCore.net

C#

TreeNode 찾기

탑~! 2011. 12. 14. 17:05

private void FindNodeInHierarchy(Infragistics.Win.UltraWinTree.TreeNodesCollection nodes, string strSearchValue)
        {
            for (int iCount = 0; iCount < nodes.Count; iCount++)
            {
                //System.Diagnostics.Debug.Print(nodes[iCount].Text.ToUpper());
                UltraTreeNode childNode = this.GetNodeByKey(nodes[iCount].Key);

                if (nodes[iCount].Text.ToUpper().Contains(strSearchValue.ToUpper()))
                {
                    childNode.Parent.Expanded = true;
                    childNode.Selected = true;
                    this.ExpandParentNodeInHierarchy(childNode);
                    m_bNodeFound = true;
                    this.FormInterface.CloseProgressBar();
                    return;
                }
                else
                {
                    childNode.CollapseAll();
                    m_bNodeFound = false;
                }
                //nodes[iCount].Expanded = true;
                FindNodeInHierarchy(nodes[iCount].Nodes, strSearchValue);
                if (m_bNodeFound)
                {
                    this.FormInterface.CloseProgressBar();
                    return;
                }
            }
        }

728x90
반응형