鼠标悬停事件上的Hightlight列表框项目

use*_*618 3 .net c# windows winforms

listview当鼠标悬停在项目上时,我试图更改项目的背景颜色

我有一个鼠标悬停事件,但是如何在鼠标悬停在项目上时添加"突出显示"效果?

private void pinnedAppsListBox_MouseHover(object sender, EventArgs e)
{

}
Run Code Online (Sandbox Code Playgroud)

小智 10

用这个:

private void pinnedAppsListBox_MouseHover(object sender, EventArgs e){

   Point point = pinnedAppsListBox.PointToClient(Cursor.Position);
   int index = pinnedAppsListBox.IndexFromPoint(point);
   if (index < 0) return;
   //Do any action with the item
   pinnedAppsListBox.GetItemRectangle(index).Inflate(1,2);
}
Run Code Online (Sandbox Code Playgroud)