TreeViewEventArgs 클래스

정의

AfterCheck 컨트롤의 AfterCollapse, AfterExpand, AfterSelect 또는 TreeView 이벤트에 대한 날짜를 지정합니다.

public ref class TreeViewEventArgs : EventArgs
public class TreeViewEventArgs : EventArgs
type TreeViewEventArgs = class
    inherit EventArgs
Public Class TreeViewEventArgs
Inherits EventArgs
상속
TreeViewEventArgs

예제

다음 예제에서는 사용자 지정 TreeView합니다. 상속 하는 TreeView 클래스를 사용자 지정이 버전에는 보통의 모든 기능 TreeView합니다. 생성자에서 다양 한 속성 값 변경에 고유한 모양을 제공 합니다. 때문에 합니다 ShowPlusMinus 속성이 false로 설정 되어, 사용자 지정된 컨트롤 재정의 OnAfterSelect 메서드 노드를 확장 하 고 클릭할 때 축소할 수 있습니다.

이러한 방식으로 사용자 지정 된 컨트롤을 쉽게 컨트롤 속성을 개별 프로젝트 각각 지정 하지 않고도 일관 된 인터페이스를 제공 하는 조직 전반에 걸쳐 사용할 수 있습니다.

public ref class CustomizedTreeView: public TreeView
{
public:
   CustomizedTreeView()
   {

      // Customize the TreeView control by setting various properties.
      BackColor = System::Drawing::Color::CadetBlue;
      FullRowSelect = true;
      HotTracking = true;
      Indent = 34;
      ShowPlusMinus = false;

      // The ShowLines property must be false for the FullRowSelect
      // property to work.
      ShowLines = false;
   }

protected:
   virtual void OnAfterSelect( TreeViewEventArgs^ e ) override
   {
      // Confirm that the user initiated the selection.
      // This prevents the first node from expanding when it is
      // automatically selected during the initialization of
      // the TreeView control.
      if ( e->Action != TreeViewAction::Unknown )
      {
         if ( e->Node->IsExpanded )
         {
            e->Node->Collapse();
         }
         else
         {
            e->Node->Expand();
         }
      }

      
      // Remove the selection. This allows the same node to be
      // clicked twice in succession to toggle the expansion state.
      SelectedNode = nullptr;
   }
};
public class CustomizedTreeView : TreeView
{
    public CustomizedTreeView()
    {
        // Customize the TreeView control by setting various properties.
        BackColor = System.Drawing.Color.CadetBlue;
        FullRowSelect = true;
        HotTracking = true;
        Indent = 34;
        ShowPlusMinus = false;

        // The ShowLines property must be false for the FullRowSelect 
        // property to work.
        ShowLines = false;
    }

    protected override void OnAfterSelect(TreeViewEventArgs e)
    {
        // Confirm that the user initiated the selection.
        // This prevents the first node from expanding when it is
        // automatically selected during the initialization of 
        // the TreeView control.
        if (e.Action != TreeViewAction.Unknown)
        {
            if (e.Node.IsExpanded) 
            {
                e.Node.Collapse();
            }
            else 
            {
                e.Node.Expand();
            }
        }

        // Remove the selection. This allows the same node to be
        // clicked twice in succession to toggle the expansion state.
        SelectedNode = null;
    }
}
Public Class CustomizedTreeView
    Inherits TreeView

    Public Sub New()
        ' Customize the TreeView control by setting various properties.
        BackColor = System.Drawing.Color.CadetBlue
        FullRowSelect = True
        HotTracking = True
        Indent = 34
        ShowPlusMinus = False

        ' The ShowLines property must be false for the FullRowSelect 
        ' property to work.
        ShowLines = False
    End Sub


    Protected Overrides Sub OnAfterSelect(ByVal e As TreeViewEventArgs)
        ' Confirm that the user initiated the selection.
        ' This prevents the first node from expanding when it is
        ' automatically selected during the initialization of 
        ' the TreeView control.
        If e.Action <> TreeViewAction.Unknown Then
            If e.Node.IsExpanded Then
                e.Node.Collapse()
            Else
                e.Node.Expand()
            End If
        End If

        ' Remove the selection. This allows the same node to be
        ' clicked twice in succession to toggle the expansion state.
        SelectedNode = Nothing
    End Sub

End Class

설명

이벤트 처리에 대한 자세한 내용은 이벤트 처리 및 발생 을 참조하십시오.

생성자

TreeViewEventArgs(TreeNode)

지정된 트리 노드에 대한 TreeViewEventArgs 클래스의 새 인스턴스를 초기화합니다.

TreeViewEventArgs(TreeNode, TreeViewAction)

이벤트를 발생시킨 지정된 형식의 작업과 함께 지정된 트리 노드에 대한 TreeViewEventArgs 클래스의 새 인스턴스를 초기화합니다.

속성

Action

이벤트를 발생시킨 작업 형식을 가져옵니다.

Node

이미 확인, 확장명, 축소 또는 선택한 트리 노드를 가져옵니다.

메서드

Equals(Object)

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

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

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

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

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

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

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

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

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

(다음에서 상속됨 Object)

적용 대상

추가 정보