private void build( TreeNodeCollection from , TreeNodeCollection to , TreeNode parent ) { TreeNodeCollection childNodes = from.SearchByParentId( parent.Id ) ; foreach( TreeNode n in childNodes ) { to.Add(n); this.build( from , n.ChildNodes , n ) ; } }
/// <summary> /// ��ӽڵ� /// </summary> /// <param name="value"></param> /// <returns></returns> public int Add( TreeNode value ) { value.SetParentNode( this._ParentNode ) ; if( _Owner != null ) { _Owner.OnTreeNodeCreated( value ) ; } return( List.Add( value ) ); }
/// <summary> /// /// </summary> /// <param name="parent"></param> public TreeNodeCollection( TreeNode parent ) { _ParentNode = parent; }
/// <summary> /// /// </summary> /// <param name="owner"></param> /// <param name="parent"></param> public TreeNodeCollection( TreeView owner , TreeNode parent ) { _Owner = owner ; _ParentNode = parent; }
/// <summary> /// ɾ���ڵ� /// </summary> /// <param name="value"></param> public void Remove( TreeNode value ) { List.Remove( value ); }
/// <summary> /// ����ڵ� /// </summary> /// <param name="index"></param> /// <param name="value"></param> public void Insert( int index, TreeNode value ) { value.SetParentNode( this._ParentNode ) ; if( _Owner != null ) { _Owner.OnTreeNodeCreated( value ) ; } List.Insert( index, value ); }
/// <summary> /// ��ȡ�ڵ����� /// </summary> /// <param name="value"></param> /// <returns></returns> public int IndexOf( TreeNode value ) { return( List.IndexOf( value ) ); }
/// <summary> /// �Ƿ�����ڵ� /// </summary> /// <param name="value"></param> /// <returns></returns> public bool Contains( TreeNode value ) { return( List.Contains( value ) ); }