日期:2014-05-17  浏览次数:20727 次

给list view控件 添加个自定义事件
如题,当listview add 和 remove item 时添加个事件处理。望大牛给个代码
listview 控件 C# 自定义事件

------解决方案--------------------
listview  不是已经有自带这些事件处理了吗?
ADD 对应ListView1_ItemCreated 
remove  对应 ListView1_ItemDeleting
如果要再增加事件的话  
this.ListView1.ItemDeleting+=new EventHandler<ListViewDeleteEventArgs>(ListView1_ItemDeleting2);
public EventHandler<ListViewDeleteEventArgs> ListView1_ItemDeleting2 (object sender, ListViewItemEventArgs e){}
------解决方案--------------------
this.ListView1.ItemDeleting+=new EventHandler<ListViewDeleteEventArgs>(ListView1_ItemDeleting2); 
this.ListView1.ItemAdding+=new EventHandler<ListViewAddEventArgs>(ListView1_ItemAdding2); 

public EventHandler<ListViewDeleteEventArgs> ListView1_ItemDeleting2 (object sender, ListViewItemEventArgs e)
{
     DoSomeThing();
}


public EventHandler<ListViewAddEventArgs> ListView1_ItemAdding2(object sender, ListViewItemEventArgs e)
{
     DoSomeThing();
}

public void DoSomeThing()
{

}