473,749 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Detect mouse leaving from a list view item

Hi all,
I am working on a windows application with a list view on a form.
Now I wanted to show hand cursor when mouse is over list view item and
default(arrow) cursor at other places.

List view's ItemMouseHover event can tell me that mouse is on the
item and here I can change my cursor to hand. But I have no clue to
change it back to default cursor when mouse is moved out of the list
view item.

How can I detect that mouse is moved away/out of the list view
item??

I have also tried to use HitTest method of the list view in the
MouseMove event but it is causing lots of overhead and sometimes hangs
the application. So I am not using this option.
Can someone give me an idea how to achieve it.

Thanks!!
Oct 8 '08 #1
2 5527
This seems to work fine for me. Never locks up. I dont know if you had an
issue with constantly setting the cursor. Thats why i check it before setting
it:

private void listView1_Mouse Move(object sender, MouseEventArgs e)
{
if (listView1.HitT est(e.X, e.Y).Item == null && (this.Cursor !=
Cursors.Default ))
{
this.Cursor = Cursors.Default ;
}
else if (this.Cursor == Cursors.Default )
{
this.Cursor = Cursors.Hand;
}
}

--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"Mohit" wrote:
Hi all,
I am working on a windows application with a list view on a form.
Now I wanted to show hand cursor when mouse is over list view item and
default(arrow) cursor at other places.

List view's ItemMouseHover event can tell me that mouse is on the
item and here I can change my cursor to hand. But I have no clue to
change it back to default cursor when mouse is moved out of the list
view item.

How can I detect that mouse is moved away/out of the list view
item??

I have also tried to use HitTest method of the list view in the
MouseMove event but it is causing lots of overhead and sometimes hangs
the application. So I am not using this option.
Can someone give me an idea how to achieve it.

Thanks!!
Oct 8 '08 #2
Hi,
Thanks Ciaran for your response.

Even after adding up cursor check it is still causing up to lots of
overhead and hanging up the application. CPU utilization clock is
showing up 100% usage when mouse is moved over the list view and
various items for a considerable amount of time.

Is there some other alternative exist??
Oct 10 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2419
by: Eitan | last post by:
Hello, I am creating a new window class based on CWnd. I am placing it on the View (CFormView). How can I get the notification or any other indication that the cursor/mouse is not on this window? I also tried the same to create a new window based on CStatic but I was not able to detect when the mouse leaves the window. Regards,
0
1110
by: Eitan | last post by:
Hello, I am creating a new window class based on CWnd. I am placing it on the View (CFormView). How can I get the notification or any other indication that the cursor/mouse is not on this window? I also tried the same to create a new window based on CStatic but I was not able to detect when the mouse leaves the window. Regards,
7
2082
by: who be dat? | last post by:
I need some help here. I'm creating a list on a page where the list is created from a dataset with two tables linked with a datarelation. The first table is a list of groups while the second table is a list of items in that group. I want to show these items in what would basically look a lot like a tree view. I decided to just show everything in a placeholder control on an aspx form. First, I display a groupname from the first table...
0
3239
by: Brian Henry | last post by:
Here is another virtual mode example for the .NET 2.0 framework while working with the list view. Since you can not access the items collection of the list view you need to do sorting another way... here is my code on how I did it to help anyone starting out get an idea of how to use virtual mode in ..NET 2.0 Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared
3
4875
by: Steve Long | last post by:
I hope this isn't too stupid of a question but I'm looking for a way to change an item in a listview control when the mouse moves over it. I'd like to change its color and underline it for a probable internet link. Is there a way to do that? I've looked through the help and can't find anything that, well, helps. Perhaps I'm using the wrong control. Any help would be appreciated. Thanks Steve
5
11814
by: Pavan | last post by:
My goal is to accomplish the tooltip functionality for all the neodes in a tree view and i have the following three Events in my C# application. Name of my TreeView Control (AITreeView) 1) AITreeView_MouseDown(object sender, MouseEventArgs e) 2) AITreeView_MouseUp(AITreeView_MouseDown(object sender, MouseEventArgs e) 3) AITreeView_Click(AITreeView_MouseDown(object sender, MouseEventArgs e)
2
2718
by: Roberto Reale | last post by:
While developing a drag&drop enabled application I found out this "strange" behaviour: if I put a message box into the QueryContinueDrag event handler the message box is shown but the mouse cursor is set to WaitCursor (Hourglass) and I can't click on OK or on X, so that the only way to close the message box is via the keyboard, by pressing SPACE key. The most strange thing is that if I place two message boxes, only the first one is...
1
5375
by: Sim | last post by:
Hello NG, I try to use drag and drop function between two list views. For this I found following code: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchimpdragdrop.asp It works fine, but I have another problem. I want to create functionality like a Windows Explorer. This means, if I select some items from list view No 1 and drag&drop this to the list view No 2, then I want to mark automatically
2
5596
by: james | last post by:
Hello I'm implementing drag and drop between two listviews (in detail view mode). When I drag an item from box a to box b, I then process information relating to the two items. The item from box a does not need to be added into box b. What I can't see how to do is for the item under the mouse in box b when I'm dragging to get selected/highlighted? I can get the index of the item in B so I know which item it is, it's just
0
8996
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8255
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.