編集対象のラベルを保持している ListViewItem の 0 から始まるインデックス番号を取得します。
Public ReadOnly Property Item As Integer
[C#]
public int Item {get;}
[C++]
public: __property int get_Item();
[JScript]
public function get Item() : int;
プロパティ値
ListViewItem の 0 から始まるインデックス番号。
使用例
[Visual Basic, C#] System.Windows.Forms.EditLabelEventArgs クラスを使用して、ListView. BeforeLabelEdit イベントを処理するコード例を次に示します。この例を実行するには、ListView1 という名前の ListView コントロールが配置されているフォームに、次のコードを貼り付けます。このコントロールには少なくとも 3 つの項目が読み込まれています。
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
[C#]
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;
}
}
[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
LabelEditEventArgs クラス | LabelEditEventArgs メンバ | System.Windows.Forms 名前空間