ListView.FindNearestItem Method

Definition

Finds the next item from a given point, searching in the specified direction.

Overloads

FindNearestItem(SearchDirectionHint, Point)

Finds the next item from the given point, searching in the specified direction.

FindNearestItem(SearchDirectionHint, Int32, Int32)

Finds the next item from the given x- and y-coordinates, searching in the specified direction.

FindNearestItem(SearchDirectionHint, Point)

Finds the next item from the given point, searching in the specified direction.

public:
 System::Windows::Forms::ListViewItem ^ FindNearestItem(System::Windows::Forms::SearchDirectionHint dir, System::Drawing::Point point);
public System.Windows.Forms.ListViewItem FindNearestItem (System.Windows.Forms.SearchDirectionHint dir, System.Drawing.Point point);
member this.FindNearestItem : System.Windows.Forms.SearchDirectionHint * System.Drawing.Point -> System.Windows.Forms.ListViewItem

Parameters

dir
SearchDirectionHint

One of the SearchDirectionHint values.

point
Point

The point at which to begin searching.

Returns

The ListViewItem that is closest to the given point, searching in the specified direction.

Exceptions

View is set to a value other than SmallIcon or LargeIcon.

Remarks

The FindNearestItem method returns null if no item is found in the given direction. Identifying the nearest item can vary depending on the operating system the application is running on, and will affect the results of FindNearestItem.

FindNearestItem(SearchDirectionHint, Int32, Int32)

Finds the next item from the given x- and y-coordinates, searching in the specified direction.

public:
 System::Windows::Forms::ListViewItem ^ FindNearestItem(System::Windows::Forms::SearchDirectionHint searchDirection, int x, int y);
public System.Windows.Forms.ListViewItem FindNearestItem (System.Windows.Forms.SearchDirectionHint searchDirection, int x, int y);
member this.FindNearestItem : System.Windows.Forms.SearchDirectionHint * int * int -> System.Windows.Forms.ListViewItem
Public Function FindNearestItem (searchDirection As SearchDirectionHint, x As Integer, y As Integer) As ListViewItem

Parameters

searchDirection
SearchDirectionHint

One of the SearchDirectionHint values.

x
Int32

The x-coordinate for the point at which to begin searching.

y
Int32

The y-coordinate for the point at which to begin searching.

Returns

The ListViewItem that is closest to the given coordinates, searching in the specified direction.

Exceptions

View is set to a value other than SmallIcon or LargeIcon.

Remarks

The FindNearestItem method returns null if no item is found in the given direction. Identifying the nearest item can vary depending on the operating system the application is running on, and will affect the results of FindNearestItem.

Applies to