TreeNodeMouseClickEventArgs.Node 속성

정의

클릭된 노드를 가져옵니다.

public:
 property System::Windows::Forms::TreeNode ^ Node { System::Windows::Forms::TreeNode ^ get(); };
public System.Windows.Forms.TreeNode Node { get; }
public System.Windows.Forms.TreeNode? Node { get; }
member this.Node : System.Windows.Forms.TreeNode
Public ReadOnly Property Node As TreeNode

속성 값

클릭된 TreeNode입니다.

예제

다음 코드 예제에서는 처리 하는 방법에 설명 합니다 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

적용 대상