Today in a hotel management system to use the ListView, suddenly think of whether the mouse can be moved to an item when the specific room information!
First set the MouseMove event for the ListView
1. Get the item for the current coordinate
ListViewItem LVI = this.listView.GetItemAt (e.x, e.y);
2. Determine if there is a selected item, and if so, display the corresponding information
if (LVI! = null)
{
Tooltip.show ("Test", Listview,new Point (E.X,E.Y), 1000);
Tooltip.active = true;
}
:: There was a problem when the mouse placed on the top of an item, the information in the constant flash! The reason is that when the mouse is not moving, it will respond to events, all of which add the following code to solve the problem
First define a variable private point Pointview = new points (0, 0);//Position
Then make a judgment when displaying the information
if (pointview.x! = e.x | | pointview.y! = E.Y)//Prevent flicker
{
Tooltip.show ("Test", Listview,new Point (E.X,E.Y), 1000);
pointview.x = e.x;
Pointview.y = e.y;
Tooltip.active = true;
}else
{
Tooltip.hide (ListView);
Pointview = new Point (E.X,E.Y);
}
Above, problem solving!
WinForm in the ListView mouse movement using the ToolTip to display information