TreeView.NodeMouseDoubleClick 이벤트

정의

사용자가 마우스로 TreeNode를 두 번 클릭할 때 발생합니다.

public:
 event System::Windows::Forms::TreeNodeMouseClickEventHandler ^ NodeMouseDoubleClick;
public event System.Windows.Forms.TreeNodeMouseClickEventHandler NodeMouseDoubleClick;
public event System.Windows.Forms.TreeNodeMouseClickEventHandler? NodeMouseDoubleClick;
member this.NodeMouseDoubleClick : System.Windows.Forms.TreeNodeMouseClickEventHandler 
Public Custom Event NodeMouseDoubleClick As TreeNodeMouseClickEventHandler 

이벤트 유형

예제

다음 코드 예제에서는 처리 하는 방법에 설명 합니다 NodeMouseDoubleClick 이벤트 및 사용 방법에는 TreeNodeMouseClickEventArgs합니다. 이 예제를 실행 하려면 코드를 포함 하는 Windows 폼에 붙여 넣습니다를 TreeView 라는 treeView1합니다. 채우기 treeView1 에 있는 파일의 이름으로는 c:\ 샘플을 실행 중인 시스템의 디렉터리와 연결 합니다 NodeMouseDoubleClick 이벤트를 treeView1 사용 하 여를 treeView1_NodeMouseDoubleClick 이 예제의 메서드. 이 예제에서는 사용자에게 예제를 실행하는 컴퓨터에 대한 관리자 권한이 있어야 합니다.

    // If a node is double-clicked, open the file indicated by the TreeNode.
private:
    void InitialTreeView_NodeMouseDoubleClick(Object^ sender,
        TreeNodeMouseClickEventArgs^ e)
    {
        try
        {
            // Look for a file extension.
            if (e->Node->Text->Contains("."))
            {
                System::Diagnostics::Process::Start("c:\\" + e->Node->Text);
            }
        }
        // If the file is not found, handle the exception and inform the user.
        catch (System::ComponentModel::Win32Exception^)
        {
            MessageBox::Show("File not found.");
        }
    }
// If a node is double-clicked, open the file indicated by the TreeNode.
void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
{
    try
    {
        // Look for a file extension.
        if (e.Node.Text.Contains("."))
            System.Diagnostics.Process.Start(@"c:\" + e.Node.Text);
    }
        // If the file is not found, handle the exception and inform the user.
    catch (System.ComponentModel.Win32Exception)
    {
        MessageBox.Show("File not found.");
    }
}
' If a node is double-clicked, open the file indicated by the TreeNode.
Sub treeView1_NodeMouseDoubleClick(ByVal sender As Object, _
    ByVal e As TreeNodeMouseClickEventArgs) _
    Handles treeView1.NodeMouseDoubleClick

    Try
        ' Look for a file extension, and open the file.
        If e.Node.Text.Contains(".") Then
            System.Diagnostics.Process.Start("c:\" + e.Node.Text)
        End If
        ' If the file is not found, handle the exception and inform the user.
    Catch
        MessageBox.Show("File not found.")
    End Try

End Sub

설명

이 이벤트에는 더하기 기호 (+)를 포함 하 여 마우스를 사용 하 여 또는 빼기 기호 (-) 노드 축소 또는 확장 여부를 나타내는 트리 노드의 모든 부분을 두 번 클릭할 때 발생 합니다.

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

적용 대상

추가 정보