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