LabelEditEventArgs.Item 속성

정의

편집할 레이블을 포함하는 ListViewItem의 0부터 시작하는 인덱스를 가져옵니다.

public:
 property int Item { int get(); };
public int Item { get; }
member this.Item : int
Public ReadOnly Property Item As Integer

속성 값

ListViewItem의 인덱스이며 0에서 시작합니다.

예제

다음 코드 예제에서는 처리를 ListView.BeforeLabelEdit 이벤트 및 사용 하는 ItemCancelEdit 속성입니다. 예제를 실행 하려면 ListView 컨트롤 ListView1 라는 및 3 개 이상의 항목으로 채워진를 포함 하는 폼에 다음 코드를 붙여 넣습니다. 모든 이벤트의 이벤트 처리 메서드를 사용 하 여 연결 되도록 합니다.

void ListView1_BeforeLabelEdit( Object^ sender,
   System::Windows::Forms::LabelEditEventArgs^ e )
{
   // Allow all but the first two items of the list to 
   // be modified by the user.
   if ( e->Item < 2 )
   {
      e->CancelEdit = true;
   }
}
private void ListView1_BeforeLabelEdit(object sender, 
    System.Windows.Forms.LabelEditEventArgs e)
{
    // Allow all but the first two items of the list to 
    // be modified by the user.
    if (e.Item<2)
    {
        e.CancelEdit = true;
    }
}

Private Sub ListView1_BeforeLabelEdit(ByVal sender As Object, _
    ByVal e As System.Windows.Forms.LabelEditEventArgs) _
    Handles ListView1.BeforeLabelEdit

    ' Allow all but the first two items of the list to be modified by
    ' the user.
    If (e.Item < 2) Then
        e.CancelEdit = True
    End If
End Sub

적용 대상