バージョン

GetSibling メソッド

UltraTreeNode の指定した兄弟を取得します。
シンタックス
'宣言
 
Public Function GetSibling( _
   ByVal nodePosition As NodePosition _
) As UltraTreeNode
public UltraTreeNode GetSibling( 
   NodePosition nodePosition
)

パラメータ

nodePosition
ノードに相対して取得する兄弟を指定します。

戻り値の型

UltraTreeNode への参照、または一致する兄弟がない場合は Nothing
解説

UltraTreeNode が Next/Previous 兄弟を持っているかどうかを決定するには、HasSibling メソッドを使用します。

使用例
Imports Infragistics.Win.UltraWinTree

Private Sub button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button18.Click

    Dim totalNodesInTree As Integer
    Dim nonRootNodes As Integer
    Dim node As UltraTreeNode

    ' ツリーのノードの合計数を取得するには、True を渡して 
    ' ツリー コントロールの 'GetNodeCount' メソッドを
    ' 呼び出します
    totalNodesInTree = Me.ultraTree1.GetNodeCount(True)

    Debug.WriteLine("Total nodes in tree = " + totalNodesInTree.ToString())
    Debug.Indent()

    ' 最初のルート ノードを取得します
    node = Me.ultraTree1.Nodes(0)

    While Not node Is Nothing
        ' ルート ノードの子孫ノードを追加します
        nonRootNodes += node.GetNodeCount(True)

        ' 次のルート ノードを取得します
        node = node.GetSibling(NodePosition.Next)
    End While

    Debug.WriteLine("root nodes = " + Me.ultraTree1.Nodes.Count.ToString())
    Debug.WriteLine("non-root nodes = " + nonRootNodes.ToString())
    Debug.IndentLevel = 0

End Sub
using System.Diagnostics;
using Infragistics.Win.UltraWinTree;

private void button18_Click(object sender, System.EventArgs e)
{

	// ツリーのノードの合計数を取得するには、True を渡して 
	// ツリー コントロールの 'GetNodeCount' メソッドを
	// 呼び出します
	int totalNodesInTree = this.ultraTree1.GetNodeCount( true );

	Debug.WriteLine( "Total nodes in tree = " + totalNodesInTree.ToString());
	Debug.Indent();

	int nonRootNodes = 0;

	// 最初のルート ノードを取得します
	UltraTreeNode node = this.ultraTree1.Nodes[0];

	while ( node != null )
	{
		// ルート ノードの子孫ノードを追加します
		nonRootNodes += node.GetNodeCount(true);

		// 次のルート ノードを取得します
		node = node.GetSibling( NodePosition.Next );
	}

	Debug.WriteLine( "root nodes = " + this.ultraTree1.Nodes.Count.ToString() );
	Debug.WriteLine( "non-root nodes = " + nonRootNodes.ToString());
	Debug.IndentLevel = 0;

}
参照