TreeViewHitTestLocations TreeViewHitTestLocations TreeViewHitTestLocations TreeViewHitTestLocations Enum

定义

定义一些常量,表示的区域TreeViewTreeNodeDefines constants that represent areas of a TreeView or TreeNode.

此枚举有一个 FlagsAttribute 属性,允许按位组合成员值。

public enum class TreeViewHitTestLocations
[System.Flags]
[System.Runtime.InteropServices.ComVisible(true)]
public enum TreeViewHitTestLocations
type TreeViewHitTestLocations = 
Public Enum TreeViewHitTestLocations
继承
TreeViewHitTestLocationsTreeViewHitTestLocationsTreeViewHitTestLocationsTreeViewHitTestLocations
属性

字段

AboveClientArea AboveClientArea AboveClientArea AboveClientArea 256

客户端部分之上的位置TreeView控件。A position above the client portion of a TreeView control.

BelowClientArea BelowClientArea BelowClientArea BelowClientArea 512

客户端部分之下的位置TreeView控件。A position below the client portion of a TreeView control.

Image Image Image Image 2

在包含的图像的边界内的位置TreeViewTreeNodeA position within the bounds of an image contained on a TreeView or TreeNode.

Indent Indent Indent Indent 8

缩进区域中的位置TreeNodeA position in the indentation area for a TreeNode.

Label Label Label Label 4

文本部分上的位置TreeNodeA position on the text portion of a TreeNode.

LeftOfClientArea LeftOfClientArea LeftOfClientArea LeftOfClientArea 2048

工作区的左侧位置TreeView控件。A position to the left of the client area of a TreeView control.

None None None None 1

中的工作区的位置TreeView控件,但不能对一个节点或节点的一部分。A position in the client area of the TreeView control, but not on a node or a portion of a node.

PlusMinus PlusMinus PlusMinus PlusMinus 16

加/减按钮区域中的某个位置TreeNodeA position on the plus/minus area of a TreeNode.

RightOfClientArea RightOfClientArea RightOfClientArea RightOfClientArea 1024

右侧的工作区的位置TreeView控件。A position to the right of the client area of the TreeView control.

RightOfLabel RightOfLabel RightOfLabel RightOfLabel 32

文本区域的右侧位置TreeNodeA position to the right of the text area of a TreeNode.

StateImage StateImage StateImage StateImage 64

状态图像的边界内的位置TreeNodeA position within the bounds of a state image for a TreeNode.

示例

下面的代码示例演示如何使用TreeViewHitTestLocations枚举。The following code example demonstrates how to use the TreeViewHitTestLocations enumeration. 若要运行此示例,请将以下代码粘贴到包含一个 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 in this example.

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

注解

TreeViewHitTestLocations枚举由TreeViewHitTestInfo类。The TreeViewHitTestLocations enumeration is used by the TreeViewHitTestInfo class.

适用于