了解ListView的成员和简单demo请查看详解一和详解二
Demo3:
拖放ListVIewItem实现重新排序
注意拖放的事件发生顺序(讲解一)
Code:
private void btnDemo3_Click(object sender, EventArgs e)
{
lvContainer.BeginUpdate();
lvContainer.Clear();
//如果不设置为View.List则会导致ListView.Items.Insert函数插入的ListViewItem在最后一项
lvContainer.View = View.List;
//必须设置为true
lvContainer.AllowDrop = true;
lvContainer.SmallImageList = imageListSource;
for (int i = 0; i < 10; i++)
{
ListViewItem item = new ListViewItem();
item.ImageIndex<