你能在你的列表视图的 SelectedIndexChanged 事件中试试这个吗?
ListViewItem lv = YourListview.GetItemAt(YourListView.PointToClient(Cursor.Position).X, YourListView.PointToClient(Cursor.Position).Y);
// this kind of Control.GetItemAt() works everywhere you need to find your mouse position ;)
// if you need to find position for screen (i.e. if you want to show a messagebox at the center of screen) you can use PointToScreen instead of PointToClient
if (lv == null)
{
return;
}
else if (yourfirstpossibility == true)
{
lv.Selected = true;
lv.BackColor = Color.FromKnownColor(KnownColor.ButtonHighLight);
// or which color you prefer. FromKnownColor retrieves system colors which you can see in backcolor / forecolor property => "system" named palette
}
我在 item_checked 事件中为我的列表视图使用的这段代码有点不同(更复杂)..希望它对你有帮助..