TreeNodeCollection.Item プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > TreeNodeCollection.Item プロパティの意味・解説 

TreeNodeCollection.Item プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

TreeNodeCollection オブジェクト内の指定したインデックス位置にある TreeNode オブジェクト取得します

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Dim instance As TreeNodeCollection
Dim index As Integer
Dim value As TreeNode

value = instance(index)
public TreeNode this [
    int index
] { get; }
public:
property TreeNode^ default [int] {
    TreeNode^ get (int index);
}
/** @property */
public TreeNode get_Item (int index)

パラメータ

index

取得する TreeNode オブジェクトの 0 から始まるインデックス番号

プロパティ
TreeNodeCollection 内の指定したインデックス位置TreeNode オブジェクト

解説解説
使用例使用例

インデクサ使用して TreeNodeCollection 内の要素アクセスする方法の例を次に示しますNodes プロパティおよび ChildNodes プロパティは、TreeNodeCollection オブジェクト返します

<%@ Page Language="VB" %>

<script runat="server">

  Sub Page_Load(ByVal sender As
 Object, ByVal e As EventArgs)

    If Not IsPostBack Then

      ' Use the Add and Remove methods to programmatically 
      ' remove the Appendix C node and replace it with a new 
      ' node. 
      LinksTreeView.Nodes.Remove(LinksTreeView.Nodes(3))
      LinksTreeView.Nodes.Add(New TreeNode("New
 Appendix C"))

      ' Use the AddAt and RemoveAt methods to programmatically 
      ' remove the Chapter One node and replace it with a new node.
      LinksTreeView.Nodes(0).ChildNodes.RemoveAt(0)
      LinksTreeView.Nodes(0).ChildNodes.AddAt(0, New TreeNode("New
 Chapter One"))

      ' Use the Clear method to remove all the child nodes of the 
      ' Chapter Two node.
      LinksTreeView.Nodes(0).ChildNodes(1).ChildNodes.Clear()

    End If

  End Sub

</script>

<html>
  <body>
    <form runat="server">
    
      <h3>TreeNodeCollection Example</h3>
    
      <asp:TreeView id="LinksTreeView"
        Font-Name= "Arial"
        ForeColor="Blue"
        runat="server">
         
        <LevelStyles>
        
          <asp:TreeNodeStyle ChildNodesPadding="10"
 
            Font-Bold="true" 
            Font-Size="12pt" 
            ForeColor="DarkGreen"/>
          <asp:TreeNodeStyle ChildNodesPadding="5"
 
            Font-Bold="true" 
            Font-Size="10pt"/>
          <asp:TreeNodeStyle ChildNodesPadding="5"
 
            Font-UnderLine="true" 
            Font-Size="10pt"/>
          <asp:TreeNodeStyle ChildNodesPadding="10"
 
            Font-Size="8pt"/>
             
        </LevelStyles>
         
        <Nodes>
        
          <asp:TreeNode Text="Table of Contents"
            Expanded="true">
             
            <asp:TreeNode Text="Chapter One">
            
              <asp:TreeNode Text="Section 1.0">
              
                <asp:TreeNode Text="Topic 1.0.1"/>
                <asp:TreeNode Text="Topic 1.0.2"/>
                <asp:TreeNode Text="Topic 1.0.3"/>
              
              </asp:TreeNode>
              
              <asp:TreeNode Text="Section 1.1">
              
                <asp:TreeNode Text="Topic 1.1.1"/>
                <asp:TreeNode Text="Topic 1.1.2"/>
                <asp:TreeNode Text="Topic 1.1.3"/>
                <asp:TreeNode Text="Topic 1.1.4"/>
              
              </asp:TreeNode>
            
            </asp:TreeNode>
            
            <asp:TreeNode Text="Chapter Two">
            
              <asp:TreeNode Text="Section 2.0">
              
                <asp:TreeNode Text="Topic 2.0.1"/>
                <asp:TreeNode Text="Topic 2.0.2"/>
              
              </asp:TreeNode>
            
            </asp:TreeNode>
            
          </asp:TreeNode>
          
          <asp:TreeNode Text="Appendix A" />
          <asp:TreeNode Text="Appendix B" />
          <asp:TreeNode Text="Appendix C" />
        
        </Nodes>
        
      </asp:TreeView>

    </form>
  </body>
</html>

<%@ Page Language="C#" %>

<script runat="server">

  void Page_Load(Object sender, EventArgs e)
  {

    if (!IsPostBack)
    {

      // Use the Add and Remove methods to programmatically 
      // remove the Appendix C node and replace it with a new 
      // node. 
      LinksTreeView.Nodes.Remove(LinksTreeView.Nodes[3]);
      LinksTreeView.Nodes.Add(new TreeNode("New Appendix
 C"));

      // Use the AddAt and RemoveAt methods to programmatically 
      // remove the Chapter One node and replace it with a new node.
      LinksTreeView.Nodes[0].ChildNodes.RemoveAt(0);
      LinksTreeView.Nodes[0].ChildNodes.AddAt(0, new TreeNode("New
 Chapter One"));

      // Use the Clear method to remove all the child nodes of the 
      // Chapter Two node.
      LinksTreeView.Nodes[0].ChildNodes[1].ChildNodes.Clear();

    }

  }

</script>

<html>
  <body>
    <form runat="server">
    
      <h3>TreeNodeCollection Example</h3>
    
      <asp:TreeView id="LinksTreeView"
        Font-Name= "Arial"
        ForeColor="Blue"
        runat="server">
         
        <LevelStyles>
        
          <asp:TreeNodeStyle ChildNodesPadding="10" 
            Font-Bold="true" 
            Font-Size="12pt" 
            ForeColor="DarkGreen"/>
          <asp:TreeNodeStyle ChildNodesPadding="5" 
            Font-Bold="true" 
            Font-Size="10pt"/>
          <asp:TreeNodeStyle ChildNodesPadding="5" 
            Font-UnderLine="true" 
            Font-Size="10pt"/>
          <asp:TreeNodeStyle ChildNodesPadding="10" 
            Font-Size="8pt"/>
             
        </LevelStyles>
         
        <Nodes>
        
          <asp:TreeNode Text="Table of Contents"
            Expanded="true">
             
            <asp:TreeNode Text="Chapter One">
            
              <asp:TreeNode Text="Section 1.0">
              
                <asp:TreeNode Text="Topic 1.0.1"/>
                <asp:TreeNode Text="Topic 1.0.2"/>
                <asp:TreeNode Text="Topic 1.0.3"/>
              
              </asp:TreeNode>
              
              <asp:TreeNode Text="Section 1.1">
              
                <asp:TreeNode Text="Topic 1.1.1"/>
                <asp:TreeNode Text="Topic 1.1.2"/>
                <asp:TreeNode Text="Topic 1.1.3"/>
                <asp:TreeNode Text="Topic 1.1.4"/>
              
              </asp:TreeNode>
            
            </asp:TreeNode>
            
            <asp:TreeNode Text="Chapter Two">
            
              <asp:TreeNode Text="Section 2.0">
              
                <asp:TreeNode Text="Topic 2.0.1"/>
                <asp:TreeNode Text="Topic 2.0.2"/>
              
              </asp:TreeNode>
            
            </asp:TreeNode>
            
          </asp:TreeNode>
          
          <asp:TreeNode Text="Appendix A" />
          <asp:TreeNode Text="Appendix B" />
          <asp:TreeNode Text="Appendix C" />
        
        </Nodes>
        
      </asp:TreeView>

    </form>
  </body>
</html>

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
TreeNodeCollection クラス
TreeNodeCollection メンバ
System.Web.UI.WebControls 名前空間
TreeView
TreeNode クラス
GetEnumerator
CopyTo

TreeNodeCollection.Item プロパティ

コレクション内のツリー ノード取得または設定します
オーバーロードの一覧オーバーロードの一覧

参照参照

関連項目

TreeNodeCollection クラス
TreeNodeCollection メンバ
System.Windows.Forms 名前空間
TreeNodeCollection.Count プロパティ



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

TreeNodeCollection.Item プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



TreeNodeCollection.Item プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS