Listview 中取得鼠标点击单元格的列索引
这个功能,估计用的地方不少,只要是做ListView的单元格动态修改,就需要这个了(呵呵,至少本人是这做的),当Mouse up时做这个操作
private void lsvPort_MouseUp(object sender, MouseEventArgs e)
{try{ListViewItem item = lsvPort.GetItemAt(e.X, e.Y);portSubItem = item.GetSubItemAt(e.X, e.Y);
int intColIndex = item.SubItems.IndexOf(portSubItem);//这个就是列索引了
}catch{}
}
浙公网安备 33010602011771号