Is it possible to have a mouseover effect.
ie..if mouse over opt.caption = "This works"
mouse off opt.caption = ""
If so...how?
Printable View
Is it possible to have a mouseover effect.
ie..if mouse over opt.caption = "This works"
mouse off opt.caption = ""
If so...how?
one way i used one time was to use to position and size of my control, say a command button, then when the mouse coords were in that range, i had the appropiate action happen.
I stumbled over this trying different things..
it's all so simple in hindsight
Mousemove event on form opt.caption = ""
Mousemove event on option button opt.caption = "This works"
too easy to think of...
thanks billrogers for the spark that ignited the flame.
Code:'when mouse moves over label caption is thisworks
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label1.caption="thisworks"
end sub
Private Function MouseOff()
Label1.caption = ""
'if you have more thatn one lable add them here
End Function
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MouseOff
End Sub
that is a real easy way to do it, nice job. I like that idea.
Thanks HeSaidJoe
Actually this is done by getting the rect of your control (if you're making a usercontrol) and then get the position of mouse and then look if the point is inside the rect. If it is it's entered, if it's not, it's exited. You need to use a timer for this so have your timer only active when the cursor is inside, and let the mousemove event triggers the mouseenter eventCode:Declare Function GetWindowRect Lib "user32" Alias "GetWindowRect" (ByVal hwnd As Long, lpRect As RECT) As Long
Declare Function GetCursorPos Lib "user32" Alias "GetCursorPos" (lpPoint As POINTAPI) As Long
Type POINTAPI
x As Long
y As Long
End Type
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type