LabelEditEventArgs.Item Propriedade

Definição

Obtém o índice em base zero do ListViewItem que contém a etiqueta para editar.

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

Valor de Propriedade

O índice de base zero do ListViewItem.

Exemplos

O exemplo de código seguinte demonstra como lidar com o ListView.BeforeLabelEdit evento e usar as Item propriedades e.CancelEdit Para executar o exemplo, cole o código seguinte num formulário contendo um controlo ListView chamado ListView1 e preenchido com pelo menos 3 itens. Assegure que todos os eventos estão associados aos seus métodos de gestão de eventos.

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

Aplica-se a