LabelEditEventArgs.Item 属性    
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取 ListViewItem(它包含要编辑的标签)的从零开始的索引。
public:
 property int Item { int get(); };
	public int Item { get; }
	member this.Item : int
	Public ReadOnly Property Item As Integer
	属性值
ListViewItem 的从零开始的索引。
示例
下面的代码示例演示如何处理 ListView.BeforeLabelEdit 事件并使用 Item 和 CancelEdit 属性。 若要运行该示例,请将以下代码粘贴到包含名为 ListView1 的 ListView 控件的窗体中,并填充了至少 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