ListViewHitTestLocations ListViewHitTestLocations ListViewHitTestLocations ListViewHitTestLocations Enum

定义

定义表示 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
继承
ListViewHitTestLocationsListViewHitTestLocationsListViewHitTestLocationsListViewHitTestLocations
属性

字段

AboveClientArea AboveClientArea AboveClientArea AboveClientArea 256

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

BelowClientArea BelowClientArea BelowClientArea BelowClientArea 16

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

Image Image Image Image 2

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

Label Label Label Label 4

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

LeftOfClientArea LeftOfClientArea LeftOfClientArea LeftOfClientArea 64

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

None None None None 1

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

RightOfClientArea RightOfClientArea RightOfClientArea RightOfClientArea 32

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

StateImage StateImage StateImage StateImage 512

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

示例

下面的代码示例演示了如何使用HitTest方法来确定的位置MouseDown中的事件ListViewThe following code example demonstrates using the HitTest method to determine the location of a MouseDown event in a ListView. 若要运行此代码,请将其粘贴到包含一个 Windows 窗体ListView名为listView1填充有一些项。To run this code, paste it into a Windows Form that contains a ListView named listView1 that is populated with items. 将相关联MouseDown事件listview1并在窗体HandleMouseDown在此示例中的方法。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.

适用于