如何道鼠标悬停在ListBox的那个item上面了?

jundywoo 2007-06-21 08:24:34
ListBox已经绑定了数据,鼠标停在上面的时候,我有什么办法知道停在哪一条数据上面呢?
...全文
367 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
猫熊 2011-05-26
  • 打赏
  • 举报
回复
mark
netusemaster 2007-06-22
  • 打赏
  • 举报
回复
MARK
volezbin 2007-06-22
  • 打赏
  • 举报
回复
学习,up
纷享刘晨 2007-06-22
  • 打赏
  • 举报
回复
参看楼上
<ListBox>.IndexFromPoint(<Location>)
根据坐标得到item的索引
王集鹄 2007-06-21
  • 打赏
  • 举报
回复 1
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();
}

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧