ListViewHitTestLocations 枚举

定义

定义表示 ListViewListViewItem 中的区域的常数。Defines constants that represent areas in a ListView or ListViewItem.

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

public enum class ListViewHitTestLocations
[System.Flags]
public enum ListViewHitTestLocations
type ListViewHitTestLocations = 
Public Enum ListViewHitTestLocations
继承
ListViewHitTestLocations
属性

字段

AboveClientArea 256

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

BelowClientArea 16

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

Image 2

ListViewListViewItem 中包含的图像的边界内的一个位置。A position within the bounds of an image contained in a ListView or ListViewItem.

Label 4

ListViewListViewItem 中包含的文本区域的边界内的一个位置。A position within the bounds of a text area contained in a ListView or ListViewItem.

LeftOfClientArea 64

ListView 控件的客户端部分左边的一个位置。A position to the left of the client portion of a ListView control.

None 1

ListViewItem 的边界外的一个位置A position outside the bounds of a ListViewItem

RightOfClientArea 32

ListView 控件的客户端部分右边的一个位置。A position to the right of the client portion of a ListView control.

StateImage 512

ListViewItem 关联的图像的边界内的一个位置,该图像指示项的状态。A position within the bounds of an image associated with a ListViewItem that indicates the state of the item.

示例

下面的代码示例演示如何使用HitTest方法在中ListView确定MouseDown事件的位置。The following code example demonstrates using the HitTest method to determine the location of a MouseDown event in a ListView. 若要运行此代码, 请将其粘贴到包含ListViewlistView1为的的 Windows 窗体中, 其中填充了项。To run this code, paste it into a Windows Form that contains a ListView named listView1 that is populated with items. 将和窗体的HandleMouseDown MouseDown listview1事件与此示例中的方法相关联。Associate the MouseDown event for listview1 and the form with the HandleMouseDown method in this example.

void HandleMouseDown(object sender, MouseEventArgs e)
{
    ListViewHitTestInfo info = listView1.HitTest(e.X, e.Y);
    MessageBox.Show(info.Location.ToString());
}
Private Sub HandleMouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) _
        Handles Me.MouseDown, listView1.MouseDown

    Dim info As ListViewHitTestInfo = listView1.HitTest(e.X, e.Y)
    MessageBox.Show(info.Location.ToString())

End Sub

注解

ListViewHitTestLocations 枚举由 ListViewHitTestInfo 类使用。The ListViewHitTestLocations enumeration is used by the ListViewHitTestInfo class.

适用于