日期:2014-05-19  浏览次数:20863 次

如何道鼠标悬停在ListBox的那个item上面了?
ListBox已经绑定了数据,鼠标停在上面的时候,我有什么办法知道停在哪一条数据上面呢?

------解决方案--------------------
private void listBox1_MouseMove(object sender, MouseEventArgs e)
{
int AIndex = ((ListBox)sender).IndexFromPoint(e.Location);
if (AIndex < 0) return;
Text = ((ListBox)sender).Items[AIndex].ToString();
}