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)

按照指定的搜索方向,从给定的 X 和 Y 坐标开始查找下一个项。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
Public Function FindNearestItem (dir As SearchDirectionHint, point As Point) As ListViewItem

Parameters

dir
SearchDirectionHint

SearchDirectionHint 值之一。One of the SearchDirectionHint values.

point
Point

从该处开始执行搜索的点。The point at which to begin searching.

Returns

ListViewItem

与给定点最接近的 ListViewItem (以指定方向进行搜索)。The ListViewItem that is closest to the given point, searching in the specified direction.

Exceptions

View 设置为除 SmallIconLargeIcon 以外的值。View is set to a value other than SmallIcon or LargeIcon.

Remarks

如果在给定方向找不到任何项,FindNearestItem 方法返回 nullThe FindNearestItem method returns null if no item is found in the given direction. 标识最近的项可能因应用程序运行所在的操作系统而异,并会影响 FindNearestItem的结果。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)

按照指定的搜索方向,从给定的 X 和 Y 坐标开始查找下一个项。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

SearchDirectionHint 值之一。One of the SearchDirectionHint values.

x
Int32

在该处开始进行搜索的点的 X 坐标。The x-coordinate for the point at which to begin searching.

y
Int32

在该处开始进行搜索的点的 Y 坐标。The y-coordinate for the point at which to begin searching.

Returns

ListViewItem

与给定坐标最接近的 ListViewItem(以指定方向进行搜索)。The ListViewItem that is closest to the given coordinates, searching in the specified direction.

Exceptions

View 设置为除 SmallIconLargeIcon 以外的值。View is set to a value other than SmallIcon or LargeIcon.

Remarks

如果在给定方向找不到任何项,FindNearestItem 方法返回 nullThe FindNearestItem method returns null if no item is found in the given direction. 标识最近的项可能因应用程序运行所在的操作系统而异,并会影响 FindNearestItem的结果。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