TreeNodeTypes 列挙体
この列挙体には、メンバ値のビットごとの組み合わせを可能にする FlagsAttribute 属性が含まれています。
名前空間: System.Web.UI.WebControlsアセンブリ: System.Web (system.web.dll 内)

<FlagsAttribute> _ Public Enumeration TreeNodeTypes

メンバ名 | 説明 | |
---|---|---|
All | すべてのノード。 | |
Leaf | 子ノードがないノード。 | |
None | ノードなし。 | |
Parent | 1 つの親ノードと 1 つ以上の子ノードがあるノード。 | |
Root | 親ノードがなく、1 つ以上の子ノードがあるノード。 |

TreeNodeTypes 列挙体は、TreeView コントロールで使用できるさまざまなノード型を表すために使用されます。3 つの異なるノード型の説明を以下に示します。
TreeNodeTypes 列挙体はフラグの列挙体なので、ビットごとの演算によって複数の値を結合できます。たとえば、親ノードおよび葉ノードを表すには、Parent 値および Leaf 値でビットごとの OR 演算を実行できます。

TreeNodeTypes 列挙体を使用して、TreeView コントロールが親ノードおよび葉ノードごとにのみチェック ボックスを表示するように指定する方法を次のコード例に示します。
<%@ Page Language="VB" %> <script runat="server"> Sub Button_Click(ByVal sender As Object, ByVal e As EventArgs) If LinksTreeView.CheckedNodes.Count > 0 Then ' Clear the message label. Message.Text = "You selected: <br><br>" ' Iterate through the CheckedNodes collection and display the selected nodes. Dim node As TreeNode For Each node In LinksTreeView.CheckedNodes Message.Text &= node.Text & "<br>" Next Else Message.Text = "No items selected." End If End Sub </script> <html> <body> <form runat="server"> <h3>TreeView ShowCheckBoxes Example</h3> <!-- Set the ShowCheckBoxes property declaratively. --> <!-- Because the ShowCheckBoxes property uses a flag --> <!-- enumeration, you can combine multiple values by --> <!-- using the bitwise OR operator. In declarative --> <!-- syntax, this is done using a comma separated --> <!-- list. --> <asp:TreeView id="LinksTreeView" Font-Name= "Arial" ForeColor="Blue" InitialExpandDepth="2" ShowCheckBoxes="Parent,Leaf" 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> <br><br> <asp:Button id="Submit" Text="Select Items" OnClick="Button_Click" runat="server"/> <br><br> <asp:Label id="Message" runat="server"/> </form> </body> </html>
<%@ Page Language="C#" %> <script runat="server"> void Button_Click(Object sender, EventArgs e) { if(LinksTreeView.CheckedNodes.Count > 0) { // Clear the message label. Message.Text = "You selected: <br><br>"; // Iterate through the CheckedNodes collection and display the selected nodes. foreach (TreeNode node in LinksTreeView.CheckedNodes) { Message.Text += node.Text + "<br>"; } } else { Message.Text = "No items selected."; } } </script> <html> <body> <form runat="server"> <h3>TreeView ShowCheckBoxes Example</h3> <!-- Set the ShowCheckBoxes property declaratively. --> <!-- Because the ShowCheckBoxes property uses a flag --> <!-- enumeration, you can combine multiple values by --> <!-- using the bitwise OR operator. In declarative --> <!-- syntax, this is done using a comma separated --> <!-- list. --> <asp:TreeView id="LinksTreeView" Font-Name= "Arial" ForeColor="Blue" InitialExpandDepth="2" ShowCheckBoxes="Parent,Leaf" 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> <br><br> <asp:Button id="Submit" Text="Select Items" OnClick="Button_Click" runat="server"/> <br><br> <asp:Label id="Message" runat="server"/> </form> </body> </html>

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


Weblioに収録されているすべての辞書からTreeNodeTypes 列挙体を検索する場合は、下記のリンクをクリックしてください。

- TreeNodeTypes 列挙体のページへのリンク