TreeNodeMouseClickEventArgs Klasa

Definicja

Dostarcza dane dla zdarzeń NodeMouseClick i NodeMouseDoubleClick .

public ref class TreeNodeMouseClickEventArgs : System::Windows::Forms::MouseEventArgs
public class TreeNodeMouseClickEventArgs : System.Windows.Forms.MouseEventArgs
type TreeNodeMouseClickEventArgs = class
    inherit MouseEventArgs
Public Class TreeNodeMouseClickEventArgs
Inherits MouseEventArgs
Dziedziczenie
TreeNodeMouseClickEventArgs

Przykłady

W poniższym przykładzie kodu pokazano, jak obsługiwać NodeMouseDoubleClick zdarzenie i jak używać metody TreeNodeMouseClickEventArgs. Aby uruchomić ten przykład, wklej kod w formularzu systemu Windows zawierającym TreeView nazwę treeView1. Wypełnij treeView1 ciąg nazwami plików znajdujących się w c:\ katalogu systemu, na którym działa przykład, i skojarz NodeMouseDoubleClick zdarzenie z treeView1treeView1_NodeMouseDoubleClick metodą w tym przykładzie.

    // 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

Konstruktory

TreeNodeMouseClickEventArgs(TreeNode, MouseButtons, Int32, Int32, Int32)

Inicjuje nowe wystąpienie klasy TreeNodeMouseClickEventArgs.

Właściwości

Button

Pobiera, który przycisk myszy został naciśnięty.

(Odziedziczone po MouseEventArgs)
Clicks

Pobiera liczbę razy naciśnięcie i zwolnienie przycisku myszy.

(Odziedziczone po MouseEventArgs)
Delta

Pobiera podpisaną liczbę odcięć obracanych kółko myszy, pomnożonej przez stałą WHEEL_DELTA. Zacięcie jest jednym wycięciem kółka myszy.

(Odziedziczone po MouseEventArgs)
Location

Pobiera lokalizację myszy podczas generowania zdarzenia myszy.

(Odziedziczone po MouseEventArgs)
Node

Pobiera kliknięty węzeł.

X

Pobiera współrzędną x myszy podczas generowania zdarzenia myszy.

(Odziedziczone po MouseEventArgs)
Y

Pobiera współrzędną y myszy podczas generowania zdarzenia myszy.

(Odziedziczone po MouseEventArgs)

Metody

Equals(Object)

Określa, czy dany obiekt jest taki sam, jak bieżący obiekt.

(Odziedziczone po Object)
GetHashCode()

Służy jako domyślna funkcja skrótu.

(Odziedziczone po Object)
GetType()

Type Pobiera wartość bieżącego wystąpienia.

(Odziedziczone po Object)
MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Dotyczy