Link to home
Start Free TrialLog in
Avatar of ALIHAIDER1
ALIHAIDER1

asked on

Mouse move event of label control (vb6)

I manage a label control mouse move event to change the forecolor of the control when the mouse move over the control. But there is a problem that on mouse move event this subroutine changes the forecolor but when the mouse move from the label control to another it does not changes the forecolor which was before the mouse move event was triggered.
pls help me for the same.
sub like this
     private sub lblExam_mousemove(.......)
              lblexam.forecolor=vbgreen
         end sub
and how can i change the forecolor of the control through this sub .
pls help me
Avatar of BUCHAS
BUCHAS
Flag of Brazil image

alright, suppose the default forecolor of your label is vbred and you want to change it to vbgreen every time the user pass the mouse over it:

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

    lblexam.ForeColor = vbRed

End Sub

Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
   
    lblexam.ForeColor = vbGreen
   
End Sub
Avatar of ALIHAIDER1
ALIHAIDER1

ASKER

Dear expert
        Actuly that's not what i want. I want to manage the same within the label control subroutine. It may be handel through x and y coordinates. Or may be u have any other solution.
I dont want to use the form_mouseover sub.
I want to use just label1_mousemove sub.
Pls help me and thanks for respose.
Ali
ASKER CERTIFIED SOLUTION
Avatar of polital
polital

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I forgot to add in the interests of efficiency at the beginning of the mousemove routine

if ctrl is lbl then exit sub

You don't want to keep setting the color - once will do.

polital
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial