Прочетете на английски Редактиране

Споделяне чрез


ListView.FindNearestItem Method

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

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

Overloads

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.

FindNearestItem(SearchDirectionHint, Int32, Int32)

Source:
ListView.cs
Source:
ListView.cs
Source:
ListView.cs

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

C#
public System.Windows.Forms.ListViewItem FindNearestItem(System.Windows.Forms.SearchDirectionHint searchDirection, int x, int y);
C#
public System.Windows.Forms.ListViewItem? FindNearestItem(System.Windows.Forms.SearchDirectionHint searchDirection, int x, int y);

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

.NET Framework 4.8.1 и други версии
Продукт Версии
.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, 10

FindNearestItem(SearchDirectionHint, Point)

Source:
ListView.cs
Source:
ListView.cs
Source:
ListView.cs

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

C#
public System.Windows.Forms.ListViewItem FindNearestItem(System.Windows.Forms.SearchDirectionHint dir, System.Drawing.Point point);
C#
public System.Windows.Forms.ListViewItem? FindNearestItem(System.Windows.Forms.SearchDirectionHint dir, System.Drawing.Point point);

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.

Applies to

.NET Framework 4.8.1 и други версии
Продукт Версии
.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, 10