Edit

Share via


ListViewHitTestInfo Class

Definition

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
Inheritance
ListViewHitTestInfo

Examples

The following code example demonstrates using the ListViewHitTestInfo class and the HitTest method to determine the location of a MouseDown event. To run this code, paste it into a Windows Form that contains a ListView named listView1 that is populated with items. 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

Remarks

ListViewHitTestInfo is returned by the ListView class when the HitTest method is called.

Constructors

ListViewHitTestInfo(ListViewItem, ListViewItem+ListViewSubItem, ListViewHitTestLocations)

Initializes a new instance of the ListViewHitTestInfo class.

Properties

Item

Gets the ListViewItem at the position indicated by a hit test on a ListView.

Location

Gets the location of a hit test on a ListView control, in relation to the ListView and the items it contains.

SubItem

Gets the ListViewItem.ListViewSubItem at the position indicated by a hit test on a ListView.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to