ListViewHitTestInfo ListViewHitTestInfo ListViewHitTestInfo ListViewHitTestInfo Class

定义

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

public ref class ListViewHitTestInfo
public class ListViewHitTestInfo
type ListViewHitTestInfo = class
Public Class ListViewHitTestInfo
继承
ListViewHitTestInfoListViewHitTestInfoListViewHitTestInfoListViewHitTestInfo

示例

下面的代码示例演示了如何使用ListViewHitTestInfo类和HitTest方法来确定的位置MouseDown事件。The following code example demonstrates using the ListViewHitTestInfo class and the HitTest method to determine the location of a MouseDown event. 若要运行此代码,请将其粘贴到包含一个 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窗体的事件和listView1HandleMouseDown在此示例中的方法。Associate the MouseDown event for the form and listView1 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

注解

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

构造函数

ListViewHitTestInfo(ListViewItem, ListViewItem+ListViewSubItem, ListViewHitTestLocations) ListViewHitTestInfo(ListViewItem, ListViewItem+ListViewSubItem, ListViewHitTestLocations) ListViewHitTestInfo(ListViewItem, ListViewItem+ListViewSubItem, ListViewHitTestLocations) ListViewHitTestInfo(ListViewItem, ListViewItem+ListViewSubItem, ListViewHitTestLocations)

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

属性

Item Item Item Item

获取位于由 ListViewItem 的命中测试所指示的位置的 ListViewGets the ListViewItem at the position indicated by a hit test on a ListView.

Location Location Location Location

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

SubItem SubItem SubItem SubItem

获取位于由 ListViewItem.ListViewSubItem 的命中测试所指示的位置的 ListViewGets the ListViewItem.ListViewSubItem at the position indicated by a hit test on a ListView.

方法

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)

适用于