TreeNodeStyle イベント
TreeNodeStyle クラス
アセンブリ: System.Web (system.web.dll 内)


TreeNodeStyle クラスを使用して、TreeView コントロールのノードのスタイルを表します。TreeView コントロールでは、各種のノード タイプに対してさまざまなスタイル特性 (フォントのサイズや色など) を指定できます。
TreeNodeStyle クラスでサポートされるノード スタイルを次の表に示します。
HoverNodeStyle | |
LeafNodeStyle | |
NodeStyle | |
ParentNodeStyle | |
RootNodeStyle | |
SelectedNodeStyle |
TreeView コントロールのノード スタイル プロパティを設定する場合、これらのプロパティは次の順序で適用されます。
-
NodeStyle.
-
LevelStyles.
-
SelectedNodeStyle.
-
HoverNodeStyle.
TreeNodeStyle クラスは、Style クラスのほとんどのメンバを継承します。このクラスは、ノードのテキストの周囲の余白のサイズおよび隣接するノード間の間隔を制御するプロパティを提供することによって、Style クラスを拡張します。HorizontalPadding プロパティを使用して、ノードのテキストの左右にある余白のサイズを制御します。同様に、VerticalPadding プロパティはノードのテキストの上下にある余白のサイズを制御します。TreeNodeStyle の適用対象となるノードとそのノードに隣接するノードの間隔は、NodeSpacing プロパティを設定することによって制御できます。親ノードと子ノードの間隔を制御するには、ChildNodesPadding プロパティを使用します。

ParentNodeStyle プロパティから返される TreeNodeStyle オブジェクトのスタイル プロパティを設定して、TreeView コントロールの親ノードの外観を制御するコード方法を次のコード例に示します。
<%@ Page Language="VB" %> <script runat="server"> Sub HorizontalPadding_Changed(ByVal sender As Object, ByVal e As EventArgs) ' Programmatically set the HorizontalPadding property based on the ' user's selection. ItemsTreeView.ParentNodeStyle.HorizontalPadding = Convert.ToInt32(HorizontalPaddingList.SelectedItem.Text) End Sub Sub VerticalPadding_Changed(ByVal sender As Object, ByVal e As EventArgs) ' Programmatically set the VerticalPadding property based on the ' user's selection. ItemsTreeView.ParentNodeStyle.VerticalPadding = Convert.ToInt32(VerticalPaddingList.SelectedItem.Text) End Sub Sub NodeSpacing_Changed(ByVal sender As Object, ByVal e As EventArgs) ' Programmatically set the NodeSpacing property based on the ' user's selection. ItemsTreeView.ParentNodeStyle.NodeSpacing = Convert.ToInt32(NodeSpacingList.SelectedItem.Text) End Sub Sub ChildNodePadding_Changed(ByVal sender As Object, ByVal e As EventArgs) ' Programmatically set the ChildNodesPadding property based on the ' user's selection. ItemsTreeView.ParentNodeStyle.ChildNodesPadding = Convert.ToInt32(ChildNodesPaddingList.SelectedItem.Text) End Sub </script> <html> <body> <form runat="server"> <h3>TreeNodeStyle Example</h3> <!-- Set the styles for the leaf nodes declaratively. --> <asp:TreeView id="ItemsTreeView" Font-Name= "Arial" ForeColor="Blue" ParentNodeStyle-ForeColor="Green" ParentNodeStyle-HorizontalPadding="5" ParentNodeStyle-VerticalPadding="5" ParentNodeStyle-NodeSpacing="5" ParentNodeStyle-ChildNodesPadding="5" InitialExpandDepth="4" runat="server"> <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> </Nodes> </asp:TreeView> <hr> <h5>Select the style settings for the parent nodes.</h5> <table cellpadding="5"> <tr align="right"> <td> Horizontal Padding: <asp:DropDownList id="HorizontalPaddingList" AutoPostBack="true" OnSelectedIndexChanged="HorizontalPadding_Changed" runat="server"> <asp:ListItem>0</asp:ListItem> <asp:ListItem Selected="true">5</asp:ListItem> <asp:ListItem>10</asp:ListItem> </asp:DropDownList> </td> <td> Vertical Padding: <asp:DropDownList id="VerticalPaddingList" AutoPostBack="true" OnSelectedIndexChanged="VerticalPadding_Changed" runat="server"> <asp:ListItem>0</asp:ListItem> <asp:ListItem Selected="true">5</asp:ListItem> <asp:ListItem>10</asp:ListItem> </asp:DropDownList> </td> </tr> <tr align="right"> <td> Node Spacing: <asp:DropDownList id="NodeSpacingList" AutoPostBack="true" OnSelectedIndexChanged="NodeSpacing_Changed" runat="server"> <asp:ListItem>0</asp:ListItem> <asp:ListItem Selected="true">5</asp:ListItem> <asp:ListItem>10</asp:ListItem> </asp:DropDownList> </td> <td> Child Nodes Padding: <asp:DropDownList id="ChildNodesPaddingList" AutoPostBack="true" OnSelectedIndexChanged="ChildNodePadding_Changed" runat="server"> <asp:ListItem>0</asp:ListItem> <asp:ListItem Selected="true">5</asp:ListItem> <asp:ListItem>10</asp:ListItem> </asp:DropDownList> </td> </tr> </table> </form> </body> </html>
<%@ Page Language="C#" %> <script runat="server"> void HorizontalPadding_Changed(Object sender, EventArgs e) { // Programmatically set the HorizontalPadding property based on the // user's selection. ItemsTreeView.ParentNodeStyle.HorizontalPadding = Convert.ToInt32(HorizontalPaddingList.SelectedItem.Text); } void VerticalPadding_Changed(Object sender, EventArgs e) { // Programmatically set the VerticalPadding property based on the // user's selection. ItemsTreeView.ParentNodeStyle.VerticalPadding = Convert.ToInt32(VerticalPaddingList.SelectedItem.Text); } void NodeSpacing_Changed(Object sender, EventArgs e) { // Programmatically set the NodeSpacing property based on the // user's selection. ItemsTreeView.ParentNodeStyle.NodeSpacing = Convert.ToInt32(NodeSpacingList.SelectedItem.Text); } void ChildNodePadding_Changed(Object sender, EventArgs e) { // Programmatically set the ChildNodesPadding property based on the // user's selection. ItemsTreeView.ParentNodeStyle.ChildNodesPadding = Convert.ToInt32(ChildNodesPaddingList.SelectedItem.Text); } </script> <html> <body> <form runat="server"> <h3>TreeNodeStyle Example</h3> <!-- Set the styles for the leaf nodes declaratively. --> <asp:TreeView id="ItemsTreeView" Font-Name= "Arial" ForeColor="Blue" ParentNodeStyle-ForeColor="Green" ParentNodeStyle-HorizontalPadding="5" ParentNodeStyle-VerticalPadding="5" ParentNodeStyle-NodeSpacing="5" ParentNodeStyle-ChildNodesPadding="5" InitialExpandDepth="4" runat="server"> <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> </Nodes> </asp:TreeView> <hr> <h5>Select the style settings for the parent nodes.</h5> <table cellpadding="5"> <tr align="right"> <td> Horizontal Padding: <asp:DropDownList id="HorizontalPaddingList" AutoPostBack="true" OnSelectedIndexChanged="HorizontalPadding_Changed" runat="server"> <asp:ListItem>0</asp:ListItem> <asp:ListItem Selected="true">5</asp:ListItem> <asp:ListItem>10</asp:ListItem> </asp:DropDownList> </td> <td> Vertical Padding: <asp:DropDownList id="VerticalPaddingList" AutoPostBack="true" OnSelectedIndexChanged="VerticalPadding_Changed" runat="server"> <asp:ListItem>0</asp:ListItem> <asp:ListItem Selected="true">5</asp:ListItem> <asp:ListItem>10</asp:ListItem> </asp:DropDownList> </td> </tr> <tr align="right"> <td> Node Spacing: <asp:DropDownList id="NodeSpacingList" AutoPostBack="true" OnSelectedIndexChanged="NodeSpacing_Changed" runat="server"> <asp:ListItem>0</asp:ListItem> <asp:ListItem Selected="true">5</asp:ListItem> <asp:ListItem>10</asp:ListItem> </asp:DropDownList> </td> <td> Child Nodes Padding: <asp:DropDownList id="ChildNodesPaddingList" AutoPostBack="true" OnSelectedIndexChanged="ChildNodePadding_Changed" runat="server"> <asp:ListItem>0</asp:ListItem> <asp:ListItem Selected="true">5</asp:ListItem> <asp:ListItem>10</asp:ListItem> </asp:DropDownList> </td> </tr> </table> </form> </body> </html>

System.MarshalByRefObject
System.ComponentModel.Component
System.Web.UI.WebControls.Style
System.Web.UI.WebControls.TreeNodeStyle


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


TreeNodeStyle コンストラクタ ()
アセンブリ: System.Web (system.web.dll 内)


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


TreeNodeStyle コンストラクタ (StateBag)
アセンブリ: System.Web (system.web.dll 内)



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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


TreeNodeStyle コンストラクタ

名前 | 説明 |
---|---|
TreeNodeStyle () | TreeNodeStyle クラスの新しいインスタンスを初期化します。 |
TreeNodeStyle (StateBag) | StateBag オブジェクトの情報を指定して、TreeNodeStyle クラスの新しいインスタンスを初期化します。 |

TreeNodeStyle プロパティ


名前 | 説明 | |
---|---|---|
![]() | CanRaiseEvents | コンポーネントがイベントを発生させることがきるかどうかを示す値を取得します。 ( Component から継承されます。) |
![]() | DesignMode | Component が現在デザイン モードかどうかを示す値を取得します。 ( Component から継承されます。) |
![]() | Events | Component に結び付けられているイベント ハンドラのリストを取得します。 ( Component から継承されます。) |

TreeNodeStyle メソッド


名前 | 説明 | |
---|---|---|
![]() | Dispose | オーバーロードされます。 Component によって使用されているリソースを解放します。 ( Component から継承されます。) |
![]() | Finalize | Component がガベージ コレクションによってクリアされる前に、アンマネージ リソースを解放し、その他のクリーンアップ操作を実行します。 ( Component から継承されます。) |
![]() | GetService | Component またはその Container で提供されるサービスを表すオブジェクトを返します。 ( Component から継承されます。) |
![]() | MemberwiseClone | オーバーロードされます。 ( MarshalByRefObject から継承されます。) |

TreeNodeStyle メンバ
TreeView コントロールのノードのスタイルを表します。
TreeNodeStyle データ型で公開されるメンバを以下の表に示します。



名前 | 説明 | |
---|---|---|
![]() | CanRaiseEvents | コンポーネントがイベントを発生させることがきるかどうかを示す値を取得します。(Component から継承されます。) |
![]() | DesignMode | Component が現在デザイン モードかどうかを示す値を取得します。(Component から継承されます。) |
![]() | Events | Component に結び付けられているイベント ハンドラのリストを取得します。(Component から継承されます。) |


名前 | 説明 | |
---|---|---|
![]() | Dispose | オーバーロードされます。 Component によって使用されているリソースを解放します。 (Component から継承されます。) |
![]() | Finalize | Component がガベージ コレクションによってクリアされる前に、アンマネージ リソースを解放し、その他のクリーンアップ操作を実行します。 (Component から継承されます。) |
![]() | GetService | Component またはその Container で提供されるサービスを表すオブジェクトを返します。 (Component から継承されます。) |
![]() | MemberwiseClone | オーバーロードされます。 ( MarshalByRefObject から継承されます。) |


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

- TreeNodeStyleのページへのリンク