Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OnMouseMove

Status
Not open for further replies.

rchen

IS-IT--Management
Mar 7, 2003
16
0
0
SG
I am trying to have labels change color when the mouse is over the label. Since there is no onmouseover event, what is the best way to do this? I am able to change the color when it is on the label, but it will try to run the event as long as my mouse is moving throughout the label area. Please help. Thanks
 
Not sure what "on mouse over" is but the "On Mouse Move" will do what you want.
In there you have to check the X and Y values of the Mouse.

Private Sub Label6_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Debug.Print "X = " & X, " Y= " & Y
End Sub

I use this for testing
while the code window is open Press Ctrl-G to open the Debug window and you can see the X and Y values spew out



DougP, MCP
dposton@universal1.com

Ask me how Bar-codes can help you be more productive.
 
A little bit confused as to where the x and y come in. Maybe I worded the question wrong. I want the label to change color when it goes onto the label, but I do not want that code to keep running if the mouse is in that label area. Is there any way around this?

 
Use the MouseMove event of the label to set the color to whatever it is you want. Use the MouseMove event of the form to reset the label to the normal color. The MouseMove event of the form does not fire if the mouse is over a control so if it does fire then it stands to reason that the mouse is not over a control. :) Durkin
alandurkin@bigpond.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top