c# - Getting the item under mouse cursor in a listview control? -
Actually I'm trying to implement a feature where the user presses the key, Want to find the cursor
So I'm not using mouse events, but keyboard events that definitely do not give me a ListViewItem
I still do not know what location I need to get the status of the mouse and change it to the place of control.
Any thoughts?
If you know which list view you are interested in, then the following method will be trickle :
View private list view GetItemFromPoint (ListView listView, Point mousePosition) {// Screenwise translate the position of the mouse from the ListView point to localPoint = listView.PointToClient (mousePosition) Within // customer coordinates; See return list. GETItemAt (localPoint.X, localPoint.Y); } // Call it like this: ListViewItem Item = GetItemFromPoint (myListView, Cursor.Position);
Comments
Post a Comment