我试图在鼠标悬停在 listview
项目上时更改它的背景颜色
我有一个鼠标悬停事件,但如何在鼠标悬停在项目上时添加“突出显示”效果?
private void pinnedAppsListBox_MouseHover(object sender, EventArgs e)
{
}
最佳答案
使用这个:
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);
}
关于c# - 在鼠标悬停事件上突出显示列表框项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12340135/