TreeViewHitTestInfo TreeViewHitTestInfo TreeViewHitTestInfo TreeViewHitTestInfo Class

定义

包含有关 TreeView 控件的区域或 TreeNode 的信息。Contains information about an area of a TreeView control or a TreeNode.

public ref class TreeViewHitTestInfo
public class TreeViewHitTestInfo
type TreeViewHitTestInfo = class
Public Class TreeViewHitTestInfo
继承
TreeViewHitTestInfoTreeViewHitTestInfoTreeViewHitTestInfoTreeViewHitTestInfo

示例

下面的代码示例演示如何使用TreeViewHitTestInfo类。The following code example demonstrates how to use the TreeViewHitTestInfo class. 若要运行此示例,请将以下代码粘贴到包含一个 Windows 窗体TreeView名为控件treeView1,并填充TreeView的项。To run this example, paste the following code into a Windows Form that contains a TreeView control named treeView1, and populate the TreeView with items. 絋粄treeview1MouseDown与之关联窗体事件HandleMouseDown方法。Ensure that treeview1 and the MouseDown event for the form are associated with the HandleMouseDown method.

void HandleMouseDown(object sender, MouseEventArgs e)
{
    TreeViewHitTestInfo info = treeView1.HitTest(e.X, e.Y);
    if (info != null)
        MessageBox.Show("Hit the " + info.Location.ToString());
}
Private Sub HandleMouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) _
    Handles Me.MouseDown, treeView1.MouseDown
    Dim info As TreeViewHitTestInfo = treeView1.HitTest(e.X, e.Y)
    If (info IsNot Nothing) Then
        MessageBox.Show("Hit the " + info.Location.ToString())
    End If

End Sub

注解

TreeViewHitTestInfo返回的TreeView类时HitTest调用方法。The TreeViewHitTestInfo is returned by the TreeView class when the HitTest method is called.

构造函数

TreeViewHitTestInfo(TreeNode, TreeViewHitTestLocations) TreeViewHitTestInfo(TreeNode, TreeViewHitTestLocations) TreeViewHitTestInfo(TreeNode, TreeViewHitTestLocations) TreeViewHitTestInfo(TreeNode, TreeViewHitTestLocations)

初始化 TreeViewHitTestInfo 类的新实例。Initializes a new instance of the TreeViewHitTestInfo class.

属性

Location Location Location Location

获取 TreeView 控件上的命中测试的位置(相对于 TreeView 及其包含的节点)。Gets the location of a hit test on a TreeView control, in relation to the TreeView and the nodes it contains.

Node Node Node Node

获取位于由 TreeNode 控件的命中测试所指示的位置的 TreeViewGets the TreeNode at the position indicated by a hit test of a TreeView control.

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

适用于