TreeNodeStyle.NodeSpacing プロパティ
アセンブリ: System.Web (system.web.dll 内)

Dim instance As TreeNodeStyle Dim value As Unit value = instance.NodeSpacing instance.NodeSpacing = value
/** @property */ public Unit get_NodeSpacing () /** @property */ public void set_NodeSpacing (Unit value)
TreeNodeStyle の適用対象となるノードと、そのノードと同じレベルにある隣接するノードとの間の垂直方向の間隔 (ピクセル単位)。既定値は 0 ピクセルです。

NodeSpacing プロパティを使用して、TreeNodeStyle の適用対象となるノードと、そのノードと同じレベルにある隣接するノードとの間の垂直方向の間隔を制御します。この余白は、現在のノードの上端と前のノードの下端の間、および現在のノードの下端と次のノードの上端の間に挿入されます。TreeView コントロールの最初のノードの上には余白が表示されません。これは、コントロールの上部に不要な余白を残さないためです。
NodeSpacing プロパティおよび ChildNodesPadding プロパティは個別に適用されます。ノードを展開しているかどうかは、ノードのスペーシングに影響しません。

NodeSpacing プロパティを使用して、ツリー内で同じレベルにあるノードとその隣接するノードとの間の垂直方向の間隔を指定する方法のコード例を次に示します。
<%@ 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>

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に収録されているすべての辞書からTreeNodeStyle.NodeSpacing プロパティを検索する場合は、下記のリンクをクリックしてください。

- TreeNodeStyle.NodeSpacing プロパティのページへのリンク