TreeNode.Index プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)


TreeView.SelectedNode の Parent プロパティが表す TreeNode の Index プロパティと Text プロパティの値を表示するコード例を次に示します。この例では、TreeView コントロールが配置された Form が存在している必要があります。TreeView コントロールは 2 つ以上のルート ノードを持ち、各ルート ノードに 1 つ以上の子ノードを持っている必要があります。
Private Sub treeView1_AfterSelect(sender As Object, _ e As TreeViewEventArgs) Handles treeView1.AfterSelect ' Display the Text and Index of the ' selected tree node's Parent. If (Not e.Node.Parent Is Nothing) If (e.Node.Parent.GetType() Is GetType(TreeNode)) Then statusBar1.Text = "Parent: " + e.Node.Parent.Text + _ ControlChars.Cr + "Index Position: " + e.Node.Parent.Index.ToString() End If Else statusBar1.Text = "No parent node." End If End Sub
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { /* Display the Text and Index of the * selected tree node's Parent. */ if(e.Node.Parent!= null && e.Node.Parent.GetType() == typeof(TreeNode) ) { statusBar1.Text = "Parent: " + e.Node.Parent.Text + "\n" + "Index Position: " + e.Node.Parent.Index.ToString(); } else { statusBar1.Text = "No parent node."; } }
private: void treeView1_AfterSelect( Object^ /*sender*/, TreeViewEventArgs^ e ) { /* Display the Text and Index of the * selected tree node's Parent. */ if ( e->Node->Parent != nullptr && e->Node->Parent->GetType() == TreeNode::typeid ) { statusBar1->Text = String::Format( "Parent: {0}\n Index Position: {1}", e->Node->Parent->Text, e->Node->Parent->Index ); } else { statusBar1->Text = "No parent node."; } }
private void treeView1_AfterSelect(Object sender, TreeViewEventArgs e) { /* Display the Text and Index of the selected tree node's Parent. */ if (e.get_Node().get_Parent() != null && e.get_Node().get_Parent(). GetType().Equals(TreeNode.class.ToType())) { statusBar1.set_Text("Parent: " + e.get_Node().get_Parent(). get_Text() + "\n" + "Index Position: " + System.Convert. ToString(e.get_Node().get_Parent().get_Index())); } else { statusBar1.set_Text("No parent node."); } } //treeView1_AfterSelect

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からTreeNode.Index プロパティを検索する場合は、下記のリンクをクリックしてください。

- TreeNode.Index プロパティのページへのリンク