TreeNodeStyleCollectionとは? わかりやすく解説

TreeNodeStyleCollection クラス

メモ : このクラスは、.NET Framework version 2.0 で新しく追加されたものです。

TreeView コントロール内の TreeNodeStyle オブジェクトのコレクションを表します。

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

Public NotInheritable Class
 TreeNodeStyleCollection
    Inherits StateManagedCollection
Dim instance As TreeNodeStyleCollection
public sealed class TreeNodeStyleCollection
 : StateManagedCollection
public ref class TreeNodeStyleCollection sealed
 : public StateManagedCollection
public final class TreeNodeStyleCollection
 extends StateManagedCollection
public final class TreeNodeStyleCollection
 extends StateManagedCollection
解説解説
使用例使用例

TreeNodeStyleCollection クラスを使用して、TreeView コントロールの各レベルに対してスタイル設定を個別に指定するコード例を次に示します。LevelStyles プロパティは、TreeNodeStyleCollection オブジェクトを返します。

<%@ Page Language="VB" %>

<html>

  <body>
    <form runat="server">
    
      <h3>TreeView LevelStyles Example</h3>

      <!-- Populate the LevelStyles collection of the TreeView
 control -->
      <!-- declaratively.                                              -->
      
      <asp:TreeView id="LinksTreeView"
        Font-Name= "Arial"
        ForeColor="Blue"
        ShowExpandCollapse="false"
        InitialExpandDepth="3"
        NodeIndent="0" 
        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"
            SelectAction="None">
             
            <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#" %>

<html>

  <body>
    <form runat="server">
    
      <h3>TreeView LevelStyles Example</h3>

      <!-- Populate the LevelStyles collection of the TreeView control -->
      <!-- declaratively.                                              -->
      
      <asp:TreeView id="LinksTreeView"
        Font-Name= "Arial"
        ForeColor="Blue"
        ShowExpandCollapse="false"
        InitialExpandDepth="3"
        NodeIndent="0" 
        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"
            SelectAction="None">
             
            <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>

継承階層継承階層
System.Object
   System.Web.UI.StateManagedCollection
    System.Web.UI.WebControls.TreeNodeStyleCollection
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
TreeNodeStyleCollection メンバ
System.Web.UI.WebControls 名前空間
TreeView
StyleCollection クラス
LevelStyles

TreeNodeStyleCollection プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ Count  StateManagedCollection コレクションに格納されている要素の数を取得します。 ( StateManagedCollection から継承されます。)
パブリック プロパティ Item TreeNodeStyleCollection オブジェクト内の指定したインデックス位置にある TreeNodeStyle オブジェクトを取得または設定します。
参照参照

関連項目

TreeNodeStyleCollection クラス
System.Web.UI.WebControls 名前空間
TreeView
StyleCollection クラス
LevelStyles

TreeNodeStyleCollection メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド Add 指定した TreeNodeStyle オブジェクトを TreeNodeStyleCollection オブジェクトの末尾に追加します。
パブリック メソッド Clear  StateManagedCollection コレクションからすべての項目を削除します。 ( StateManagedCollection から継承されます。)
パブリック メソッド Contains 指定した TreeNodeStyle オブジェクトがコレクション内にあるかどうかを確認します。
パブリック メソッド CopyTo オーバーロードされます。 TreeNodeStyleCollection オブジェクトからすべての項目をコピーします。
パブリック メソッド Equals  オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。)
パブリック メソッド GetEnumerator  StateManagedCollection コレクションを反復処理する反復子を返します。 ( StateManagedCollection から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 ( Object から継承されます。)
パブリック メソッド IndexOf コレクション内の指定した TreeNodeStyle オブジェクトのインデックスを確認します。
パブリック メソッド Insert 指定した TreeNodeStyle オブジェクトを TreeNodeStyleCollection オブジェクトの指定したインデックス位置に挿入します。
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。)
パブリック メソッド Remove 指定した TreeNodeStyle オブジェクトを TreeNodeStyleCollection オブジェクトから削除します。
パブリック メソッド RemoveAt 指定したインデックス位置にある TreeNodeStyle オブジェクトを TreeNodeStyleCollection オブジェクトから削除します。
パブリック メソッド SetDirty  強制的に StateManagedCollection コレクション全体をビューステートにシリアル化します。 ( StateManagedCollection から継承されます。)
パブリック メソッド ToString  現在の Object を表す String を返します。 ( Object から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

TreeNodeStyleCollection クラス
System.Web.UI.WebControls 名前空間
TreeView
StyleCollection クラス
LevelStyles

TreeNodeStyleCollection メンバ

TreeView コントロール内の TreeNodeStyle オブジェクトのコレクションを表します。

TreeNodeStyleCollection データ型で公開されるメンバを以下の表に示します。


パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ Count  StateManagedCollection コレクションに格納されている要素の数を取得します。(StateManagedCollection から継承されます。)
パブリック プロパティ Item TreeNodeStyleCollection オブジェクト内の指定したインデックス位置にある TreeNodeStyle オブジェクトを取得または設定します。
パブリック メソッドパブリック メソッド
( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド Add 指定した TreeNodeStyle オブジェクトを TreeNodeStyleCollection オブジェクトの末尾に追加します。
パブリック メソッド Clear  StateManagedCollection コレクションからすべての項目を削除します。 (StateManagedCollection から継承されます。)
パブリック メソッド Contains 指定した TreeNodeStyle オブジェクトがコレクション内にあるかどうかを確認します。
パブリック メソッド CopyTo オーバーロードされます。 TreeNodeStyleCollection オブジェクトからすべての項目をコピーします。
パブリック メソッド Equals  オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。)
パブリック メソッド GetEnumerator  StateManagedCollection コレクションを反復処理する反復子を返します。 (StateManagedCollection から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 (Object から継承されます。)
パブリック メソッド IndexOf コレクション内の指定した TreeNodeStyle オブジェクトのインデックスを確認します。
パブリック メソッド Insert 指定した TreeNodeStyle オブジェクトを TreeNodeStyleCollection オブジェクトの指定したインデックス位置に挿入します。
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。)
パブリック メソッド Remove 指定した TreeNodeStyle オブジェクトを TreeNodeStyleCollection オブジェクトから削除します。
パブリック メソッド RemoveAt 指定したインデックス位置にある TreeNodeStyle オブジェクトを TreeNodeStyleCollection オブジェクトから削除します。
パブリック メソッド SetDirty  強制的に StateManagedCollection コレクション全体をビューステートにシリアル化します。 (StateManagedCollection から継承されます。)
パブリック メソッド ToString  現在の Object を表す String を返します。 (Object から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

TreeNodeStyleCollection クラス
System.Web.UI.WebControls 名前空間
TreeView
StyleCollection クラス
LevelStyles



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「TreeNodeStyleCollection」の関連用語

TreeNodeStyleCollectionのお隣キーワード
検索ランキング

   

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



TreeNodeStyleCollectionのページの著作権

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

©2026 GRAS Group, Inc.RSS