Edit

Share via


ListViewHitTestLocations Enum

Definition

Defines constants that represent areas in a ListView or ListViewItem.

This enumeration supports a bitwise combination of its member values.

C#
[System.Flags]
public enum ListViewHitTestLocations
Inheritance
ListViewHitTestLocations
Attributes

Fields

Name Value Description
None 1

A position outside the bounds of a ListViewItem.

Image 2

A position within the bounds of an image contained in a ListView or ListViewItem.

Label 4

A position within the bounds of a text area contained in a ListView or ListViewItem.

BelowClientArea 16

A position below the client portion of a ListView control.

RightOfClientArea 32

A position to the right of the client portion of a ListView control.

LeftOfClientArea 64

A position to the left of the client portion of a ListView control.

AboveClientArea 256

A position above the client portion of a ListView control.

StateImage 512

A position within the bounds of an image associated with a ListViewItem that indicates the state of the item.

Examples

The following code example demonstrates using the HitTest method to determine the location of a MouseDown event in a ListView. 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 listview1 and the form with the HandleMouseDown method in this example.

C#
void HandleMouseDown(object sender, MouseEventArgs e)
{
    ListViewHitTestInfo info = listView1.HitTest(e.X, e.Y);
    MessageBox.Show(info.Location.ToString());
}

Remarks

The ListViewHitTestLocations enumeration is used by the ListViewHitTestInfo class.

Applies to

Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9