Click here to Skip to main content
15,901,001 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends.

I want to create the mouse up event for all the controls that are present in the form.
My purpose is when mouse pointer is over the control they show the name of this control.
Posted
Updated 15-May-12 2:06am
v2
Comments
BobJanova 15-May-12 6:37am    
WinForms? WPF? ASP.net?

You speak of a Form containing controls. So let's assume you're using Windows Forms.

MouseUp fires whenever a mouse button is released. From what you tell us, you want to use the MouseHover event instead.

Normally, you would have to create a method that takes a control as an argument and make it output the control's name. Then you would subscribe that method to every control's MouseHover event.

Or maybe a global mouse hook[^] is what you're looking for.
 
Share this answer
 
v2
Hi
Please let me know in which technology you are talking about? is ASP.NET or Windows Forms? any way i will suggest you in both the cases:

Windows Forms
In Windows every control is Inherited from System.Windows.Forms.Control class and this control class has many mouse events MouseHover and MouseUp is the couple of events which you needed as per your Question.

Now you need to Implement one MouseHover Method/Handler and bind this method for all of your controls so that every controls mouse Hover event raises to the same method and using sender object you can get the current mouse over control and fetch the respective name and show the tooltip or what ever you want..

Web Application
Same as Windows Forms but here we have another option which is best suitable and traditional method is to use CSS + Javascript and recently we have a beautiful Tool called JQuery..
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900