Share via


TreeNodeMouseClickEventArgs Kelas

Definisi

Menyediakan data untuk peristiwa NodeMouseClick dan 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
Warisan
TreeNodeMouseClickEventArgs

Contoh

Contoh kode berikut menunjukkan cara menangani NodeMouseDoubleClick peristiwa dan cara menggunakan TreeNodeMouseClickEventArgs. Untuk menjalankan contoh ini, tempelkan kode ke dalam Formulir Windows yang berisi bernama TreeViewtreeView1. Isi treeView1 dengan nama file yang terletak di c:\ direktori sistem tempat sampel berjalan, dan kaitkan NodeMouseDoubleClick peristiwa treeView1 dengan treeView1_NodeMouseDoubleClick metode dalam contoh ini.

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

Konstruktor

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

Menginisialisasi instans baru kelas TreeNodeMouseClickEventArgs.

Properti

Button

Mendapatkan tombol mouse mana yang ditekan.

(Diperoleh dari MouseEventArgs)
Clicks

Mendapatkan berapa kali tombol mouse ditekan dan dilepaskan.

(Diperoleh dari MouseEventArgs)
Delta

Mendapatkan jumlah penahanan yang ditandatangani roda mouse telah diputar, dikalikan dengan konstanta WHEEL_DELTA. Penahanan adalah satu takik dari roda mouse.

(Diperoleh dari MouseEventArgs)
Location

Mendapatkan lokasi mouse selama menghasilkan peristiwa mouse.

(Diperoleh dari MouseEventArgs)
Node

Mendapatkan simpul yang diklik.

X

Mendapatkan koordinat x mouse selama menghasilkan peristiwa mouse.

(Diperoleh dari MouseEventArgs)
Y

Mendapatkan koordinat y mouse selama menghasilkan peristiwa mouse.

(Diperoleh dari MouseEventArgs)

Metode

Equals(Object)

Menentukan apakah objek yang ditentukan sama dengan objek saat ini.

(Diperoleh dari Object)
GetHashCode()

Berfungsi sebagai fungsi hash default.

(Diperoleh dari Object)
GetType()

Mendapatkan dari instans Type saat ini.

(Diperoleh dari Object)
MemberwiseClone()

Membuat salinan dangkal dari saat ini Object.

(Diperoleh dari Object)
ToString()

Mengembalikan string yang mewakili objek saat ini.

(Diperoleh dari Object)

Berlaku untuk