TreeNodeStyle 클래스

정의

TreeView 컨트롤의 노드 스타일을 나타냅니다.

public ref class TreeNodeStyle sealed : System::Web::UI::WebControls::Style
public sealed class TreeNodeStyle : System.Web.UI.WebControls.Style
type TreeNodeStyle = class
    inherit Style
Public NotInheritable Class TreeNodeStyle
Inherits Style
상속

예제

다음 코드 예제에서 부모 노드의 모양을 제어 하는 방법에 설명 합니다 TreeView 컨트롤의 스타일 속성을 설정 하 여는 TreeNodeStyle 에서 반환 되는 개체는 ParentNodeStyle 속성입니다.


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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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 xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>TreeNodeStyle Example</title>
</head>
<body>  
    <form id="form1" runat="server">
    
      <h3>TreeNodeStyle Example</h3>
      
      <!-- Set the styles for the leaf nodes declaratively. -->
      <asp:TreeView id="ItemsTreeView"
        Font-Names= "Arial"
        ForeColor="Blue"
        ParentNodeStyle-ForeColor="Green"
        ParentNodeStyle-HorizontalPadding="5" 
        ParentNodeStyle-VerticalPadding="5"  
        ParentNodeStyle-NodeSpacing="5"
        ParentNodeStyle-ChildNodesPadding="5"
        ExpandDepth="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="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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 xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>TreeNodeStyle Example</title>
</head>
<body>  
    <form id="form1" runat="server">
    
      <h3>TreeNodeStyle Example</h3>
      
      <!-- Set the styles for the leaf nodes declaratively. -->
      <asp:TreeView id="ItemsTreeView"
        Font-Names= "Arial"
        ForeColor="Blue"
        ParentNodeStyle-ForeColor="Green"
        ParentNodeStyle-HorizontalPadding="5" 
        ParentNodeStyle-VerticalPadding="5"  
        ParentNodeStyle-NodeSpacing="5"
        ParentNodeStyle-ChildNodesPadding="5"
        ExpandDepth="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>

설명

사용 하 여는 TreeNodeStyle 에 있는 노드의 스타일을 나타내는 클래스는 TreeView 컨트롤입니다. TreeView 컨트롤 지정할 수 있습니다 (예: 글꼴 크기 및 색) 다양 한 스타일 특성의 다른 노드 형식 각각에 대해 합니다.

다음 표에서에서 지원 되는 노드 스타일을 TreeNodeStyle 클래스입니다.

노드 스타일 속성 Description
HoverNodeStyle 마우스 포인터 위로 가져갈 때 노드에 대 한 스타일 설정입니다.
LeafNodeStyle 리프 노드에 대 한 스타일 설정입니다.
NodeStyle 노드에 대 한 기본 스타일 설정입니다.
ParentNodeStyle 부모 노드에 대 한 스타일 설정입니다.
RootNodeStyle 루트 노드에 대 한 스타일 설정입니다.
SelectedNodeStyle 선택한 노드에 대 한 스타일 설정입니다.

노드를 설정 하면의 스타일 속성을 TreeView 컨트롤 다음 순서 대로 적용 됩니다.

  1. NodeStyle.

  2. RootNodeStyle하십시오 ParentNodeStyle, 또는 LeafNodeStyle노드 형식에 따라 합니다.

  3. LevelStyles.

  4. SelectedNodeStyle.

  5. HoverNodeStyle.

TreeNodeStyle 클래스는 대부분의 멤버에서 상속 된 Style 클래스입니다. 확장 된 Style 인접 한 노드 사이의 공간 뿐만 아니라 노드에 텍스트 주위의 공간 크기를 제어 하는 속성을 제공 하 여 클래스입니다. 사용 된 HorizontalPadding 노드 텍스트의 오른쪽 및 왼쪽에 있는 공간의 양을 제어 하는 속성입니다. 마찬가지로,는 VerticalPadding 속성 노드에 대 한 텍스트 아래 및 위의 공간의 양을 제어 합니다. 사이의 간격을 제어할 수 있습니다는 TreeNodeStyle 에 적용 되 고 설정 하 여 인접 한 노드를 NodeSpacing 속성. 부모 노드와 자식 노드 간의 간격을 제어 합니다 ChildNodesPadding 속성입니다.

상속된 된 스타일 설정에 대 한 자세한 내용은 참조 하세요. Style합니다.

생성자

TreeNodeStyle()

TreeNodeStyle 클래스의 새 인스턴스를 초기화합니다.

TreeNodeStyle(StateBag)

지정된 TreeNodeStyle 개체 정보를 사용하여 StateBag 클래스의 새 인스턴스를 초기화합니다.

속성

BackColor

웹 서버 컨트롤의 배경색을 가져오거나 설정합니다.

(다음에서 상속됨 Style)
BorderColor

웹 서버 컨트롤의 테두리 색을 가져오거나 설정합니다.

(다음에서 상속됨 Style)
BorderStyle

웹 서버 컨트롤의 테두리 스타일을 가져오거나 설정합니다.

(다음에서 상속됨 Style)
BorderWidth

웹 서버 컨트롤의 테두리 너비를 가져오거나 설정합니다.

(다음에서 상속됨 Style)
CanRaiseEvents

구성 요소가 이벤트를 발생시킬 수 있는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 Component)
ChildNodesPadding

TreeNodeStyle 클래스가 적용된 자식 노드와 부모 노드 사이의 간격을 가져오거나 설정합니다.

Container

IContainer을 포함하는 Component를 가져옵니다.

(다음에서 상속됨 Component)
CssClass

클라이언트의 웹 서버 컨트롤에서 렌더링한 CSS 스타일시트 클래스를 가져오거나 설정합니다.

(다음에서 상속됨 Style)
DesignMode

Component가 현재 디자인 모드인지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 Component)
Events

Component에 연결된 이벤트 처리기의 목록을 가져옵니다.

(다음에서 상속됨 Component)
Font

웹 서버 컨트롤과 연결된 글꼴 속성을 가져옵니다.

(다음에서 상속됨 Style)
ForeColor

웹 서버 컨트롤의 전경색(보통 텍스트 색)을 가져오거나 설정합니다.

(다음에서 상속됨 Style)
Height

웹 서버 컨트롤의 높이를 가져오거나 설정합니다.

(다음에서 상속됨 Style)
HorizontalPadding

노드 텍스트의 왼쪽 및 오른쪽 여백을 가져오거나 설정합니다.

ImageUrl

노드 옆에 표시되는 이미지의 URL을 가져오거나 설정합니다.

IsEmpty

보호된 속성입니다. 스타일 요소가 상태 모음에 정의되었는지 여부를 나타내는 값을 가져옵니다.‎

(다음에서 상속됨 Style)
IsTrackingViewState

스타일 요소가 상태 모음에서 정의되었는지 여부를 나타내는 값을 반환합니다.

(다음에서 상속됨 Style)
NodeSpacing

TreeNodeStyle 개체가 적용된 노드와 인접한 노드 사이의 세로 간격을 가져오거나 설정합니다.

RegisteredCssClass

컨트롤에 등록되는 CSS 스타일시트 클래스를 가져옵니다.

(다음에서 상속됨 Style)
Site

ComponentISite를 가져오거나 설정합니다.

(다음에서 상속됨 Component)
VerticalPadding

노드 텍스트의 위쪽 및 아래쪽 여백을 가져오거나 설정합니다.

ViewState

스타일 요소를 보관하는 상태 모음을 가져옵니다.

(다음에서 상속됨 Style)
Width

웹 서버 컨트롤의 너비를 가져오거나 설정합니다.

(다음에서 상속됨 Style)

메서드

AddAttributesToRender(HtmlTextWriter)

지정된 HtmlTextWriter에 렌더링되어야 하는 HTML 특성 및 스타일을 추가합니다. 이 메서드는 주로 컨트롤 개발자가 사용합니다.

(다음에서 상속됨 Style)
AddAttributesToRender(HtmlTextWriter, WebControl)

지정된 HtmlTextWriter 및 웹 서버 컨트롤에 렌더링되어야 하는 HTML 특성과 스타일을 추가합니다. 이 메서드는 주로 컨트롤 개발자가 사용합니다.

(다음에서 상속됨 Style)
CopyFrom(Style)

지정된 Style 개체의 스타일 속성을 현재 TreeNodeStyle 개체로 복사합니다.

CreateObjRef(Type)

원격 개체와 통신하는 데 사용되는 프록시 생성에 필요한 모든 관련 정보가 들어 있는 개체를 만듭니다.

(다음에서 상속됨 MarshalByRefObject)
Dispose()

Component에서 사용하는 모든 리소스를 해제합니다.

(다음에서 상속됨 Component)
Dispose(Boolean)

Component에서 사용하는 관리되지 않는 리소스를 해제하고, 관리되는 리소스를 선택적으로 해제할 수 있습니다.

(다음에서 상속됨 Component)
Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
FillStyleAttributes(CssStyleCollection, IUrlResolutionService)

지정한 개체의 스타일 속성을 CssStyleCollection 개체에 추가합니다.

(다음에서 상속됨 Style)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetLifetimeService()
사용되지 않습니다.

이 인스턴스의 수명 정책을 제어하는 현재의 수명 서비스 개체를 검색합니다.

(다음에서 상속됨 MarshalByRefObject)
GetService(Type)

Component 또는 해당 Container에서 제공하는 서비스를 나타내는 개체를 반환합니다.

(다음에서 상속됨 Component)
GetStyleAttributes(IUrlResolutionService)

CssStyleCollection 개체에서 지정한 IUrlResolutionService 구현 개체를 검색합니다.

(다음에서 상속됨 Style)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
InitializeLifetimeService()
사용되지 않습니다.

이 인스턴스의 수명 정책을 제어하는 수명 서비스 개체를 가져옵니다.

(다음에서 상속됨 MarshalByRefObject)
LoadViewState(Object)

이전에 저장된 상태를 로드합니다.

(다음에서 상속됨 Style)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
MemberwiseClone(Boolean)

현재 MarshalByRefObject 개체의 단순 복사본을 만듭니다.

(다음에서 상속됨 MarshalByRefObject)
MergeWith(Style)

지정된 Style 개체의 스타일 속성과 현재 TreeNodeStyle 개체의 스타일 속성을 결합합니다.

Reset()

TreeNodeStyle 개체를 원래 상태로 되돌립니다.

SaveViewState()

보호된 메서드입니다. TrackViewState() 메서드가 호출된 후에 수정된 상태를 저장합니다.

(다음에서 상속됨 Style)
SetBit(Int32)

보호된 내부 메서드입니다. 상태 모음에 저장된 스타일 속성을 나타내는 내부 비트 마스크 필드를 설정합니다.

(다음에서 상속됨 Style)
SetDirty()

Style을 표시하여 해당 상태가 뷰 상태에 기록되도록 합니다.

(다음에서 상속됨 Style)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Style)
TrackViewState()

보호된 메서드입니다. 컨트롤에 상태 변경 내용 추적의 시작 부분을 표시합니다. 추적이 시작된 후에 변경된 내용은 추적되어 컨트롤 뷰 상태의 일부로 저장됩니다.

(다음에서 상속됨 Style)

이벤트

Disposed

Dispose() 메서드를 호출하여 구성 요소를 삭제할 때 발생합니다.

(다음에서 상속됨 Component)

명시적 인터페이스 구현

IStateManager.IsTrackingViewState

서버 컨트롤에서 해당 뷰 상태 변경 내용을 추적하는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 Style)
IStateManager.LoadViewState(Object)

이전에 저장된 상태를 로드합니다.

(다음에서 상속됨 Style)
IStateManager.SaveViewState()

상태 변경 내용이 포함된 개체를 반환합니다.

(다음에서 상속됨 Style)
IStateManager.TrackViewState()

상태 변경 사항 추적을 시작합니다.

(다음에서 상속됨 Style)

적용 대상

추가 정보