首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

怎么道鼠标悬停在ListBox的那个item上面了

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

如何道鼠标悬停在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();
}

热点排行