ListViewHitTestLocations 列舉

定義

定義常數,表示 ListViewListViewItem 中的區域。Defines constants that represent areas in a ListView or ListViewItem.

此列舉具有 FlagsAttribute 個屬性允許以位元方式合併其成員值。

public enum class ListViewHitTestLocations
[System.Flags]
public enum ListViewHitTestLocations
type ListViewHitTestLocations = 
Public Enum ListViewHitTestLocations
繼承
ListViewHitTestLocations
屬性

欄位

AboveClientArea 256

ListView 控制項的用戶端部分上面的位置。A position above the client portion of a ListView control.

BelowClientArea 16

ListView 控制項的用戶端部分下面的位置。A position below the client portion of a ListView control.

Image 2

ListViewListViewItem 所包含之影像範圍內的位置。A position within the bounds of an image contained in a ListView or ListViewItem.

Label 4

ListViewListViewItem 所包含之文字區域範圍內的位置。A position within the bounds of a text area contained in a ListView or ListViewItem.

LeftOfClientArea 64

ListView 控制項之用戶端部分左側的位置。A position to the left of the client portion of a ListView control.

None 1

ListViewItem 範圍以外的位置。A position outside the bounds of a ListViewItem

RightOfClientArea 32

ListView 控制項之用戶端部分右側的位置。A position to the right of the client portion of a ListView control.

StateImage 512

ListViewItem 相關聯之影像範圍內的位置,表示項目的狀態。A position within the bounds of an image associated with a ListViewItem that indicates the state of the item.

範例

下列程式碼範例將示範如何HitTest使用方法來判斷中ListViewMouseDown事件位置。The following code example demonstrates using the HitTest method to determine the location of a MouseDown event in a ListView. 若要執行此程式碼, 請將它貼入 Windows Form, ListView其中listView1包含已填入專案的名稱。To run this code, paste it into a Windows Form that contains a ListView named listView1 that is populated with items. listview1MouseDown表單的事件與此範例HandleMouseDown中的方法產生關聯。Associate the MouseDown event for listview1 and the form with the HandleMouseDown method in this example.

void HandleMouseDown(object sender, MouseEventArgs e)
{
    ListViewHitTestInfo info = listView1.HitTest(e.X, e.Y);
    MessageBox.Show(info.Location.ToString());
}
Private Sub HandleMouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) _
        Handles Me.MouseDown, listView1.MouseDown

    Dim info As ListViewHitTestInfo = listView1.HitTest(e.X, e.Y)
    MessageBox.Show(info.Location.ToString())

End Sub

備註

ListViewHitTestLocations 列舉型別是由 ListViewHitTestInfo 類別所使用。The ListViewHitTestLocations enumeration is used by the ListViewHitTestInfo class.

適用於