WinForm in the ListView mouse movement using the ToolTip to display information

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.