ListView.FindNearestItem 方法

定義

從指定的點尋找下一個項目,朝指定的方向搜尋。

多載

FindNearestItem(SearchDirectionHint, Int32, Int32)

從指定的 x 和 y 座標開始尋找下一個項目,朝指定的方向搜尋。

FindNearestItem(SearchDirectionHint, Point)

從指定的點尋找下一個項目,朝指定的方向搜尋。

FindNearestItem(SearchDirectionHint, Int32, Int32)

從指定的 x 和 y 座標開始尋找下一個項目,朝指定的方向搜尋。

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);
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

參數

searchDirection
SearchDirectionHint

其中一個 SearchDirectionHint 值。

x
Int32

開始搜尋之起點的 x 座標。

y
Int32

開始搜尋之起點的 y 座標。

傳回

ListViewItem

最接近指定座標的 ListViewItem (朝指定的方向搜尋)。

例外狀況

View 設定為 SmallIconLargeIcon 以外的值。

備註

如果在指定的方向找不到任何專案,則 FindNearestItem 方法會 null 傳回 。 根據應用程式執行所在的作業系統,識別最接近的專案可能會有所不同,並會影響 的結果 FindNearestItem

適用於

FindNearestItem(SearchDirectionHint, Point)

從指定的點尋找下一個項目,朝指定的方向搜尋。

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);
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

參數

dir
SearchDirectionHint

其中一個 SearchDirectionHint 值。

point
Point

要開始搜尋的點。

傳回

ListViewItem

最接近指定點的 ListViewItem,朝指定的方向搜尋。

例外狀況

View 設定為 SmallIconLargeIcon 以外的值。

備註

如果在指定的方向找不到任何專案,則 FindNearestItem 方法會 null 傳回 。 根據應用程式執行所在的作業系統,識別最接近的專案可能會有所不同,並會影響 的結果 FindNearestItem

適用於