TreeView.AfterSelect TreeView.AfterSelect TreeView.AfterSelect TreeView.AfterSelect Event

정의

트리 노드가 선택된 후에 발생합니다.Occurs after the tree node is selected.

public:
 event System::Windows::Forms::TreeViewEventHandler ^ AfterSelect;
public event System.Windows.Forms.TreeViewEventHandler AfterSelect;
member this.AfterSelect : System.Windows.Forms.TreeViewEventHandler 
Public Custom Event AfterSelect As TreeViewEventHandler 

예제

다음 코드 예제를 사용 하는 방법에 설명 합니다 TreeViewAction 열거형입니다.The following code example demonstrates how to use the TreeViewAction enumeration. 이 예제를 실행 하려면 포함 된 폼에서 다음 코드를 붙여 넣습니다를 TreeView 라는 컨트롤 TreeView1합니다.To run this example, paste the following code in a form that contains a TreeView control named TreeView1. 이 예제에서는 TreeView1 항목으로 채워집니다 및 AfterSelect 이벤트가 샘플에 정의 된 이벤트 처리기에 연결 합니다.This example requires that TreeView1 is populated with items and the AfterSelect event is connected to the event handler defined in the sample.

private:
   // Handle the After_Select event.
   void TreeView1_AfterSelect( System::Object^ /*sender*/, System::Windows::Forms::TreeViewEventArgs^ e )
   {
      
      // Vary the response depending on which TreeViewAction
      // triggered the event. 
      switch ( (e->Action) )
      {
         case TreeViewAction::ByKeyboard:
            MessageBox::Show( "You like the keyboard!" );
            break;

         case TreeViewAction::ByMouse:
            MessageBox::Show( "You like the mouse!" );
            break;
      }
   }
// Handle the After_Select event.
private void TreeView1_AfterSelect(System.Object sender, 
	System.Windows.Forms.TreeViewEventArgs e)
{

	// Vary the response depending on which TreeViewAction
	// triggered the event. 
	switch((e.Action))
	{
		case TreeViewAction.ByKeyboard:
			MessageBox.Show("You like the keyboard!");
			break;
		case TreeViewAction.ByMouse:
			MessageBox.Show("You like the mouse!");
			break;
	}
}
' Handle the After_Select event.
Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, _
    ByVal e As System.Windows.Forms.TreeViewEventArgs) _
        Handles TreeView1.AfterSelect

    ' Vary the response depending on which TreeViewAction
    ' triggered the event. 
    Select Case (e.Action)
        Case TreeViewAction.ByKeyboard
            MessageBox.Show("You like the keyboard!")
        Case TreeViewAction.ByMouse
            MessageBox.Show("You like the mouse!")
    End Select
End Sub

설명

노드를 선택 하지 않은 경우에이 이벤트가 발생 하지 않습니다.This event does not occur when the node is unselected. 선택 된 지울지 여부를 검색 하려면 테스트를 TreeNode.IsSelected 속성입니다.To detect whether the selection was cleared, you can test the TreeNode.IsSelected property.

이벤트 처리에 대한 자세한 내용은 이벤트 처리 및 발생 을 참조하십시오.For more information about handling events, see Handling and Raising Events.

적용 대상

추가 정보