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
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
I suggest you to do like this:
private sub Label1_mousemove(.......)
If X < 20 Or X > Label1.Width - 20 Or Y < 20 Or Y > Label1.Height - 20 Then
Label1.ForeColor = vbGreen
Else
Label1.ForeColor = vbWhite
End If
end sub
try this..................
private sub Label1_mousemove(.......)
If X < 20 Or X > Label1.Width - 20 Or Y < 20 Or Y > Label1.Height - 20 Then
Label1.ForeColor = vbGreen
Else
Label1.ForeColor = vbWhite
End If
end sub
try this..................
Check out:
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=5560&lngWId=1
Fully working code!
hec",)
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=5560&lngWId=1
Fully working code!
hec",)
i saw this code...but why u use api when it can easily be done...
anyway it is upto ALIHAIDER1 to decide....
anyway it is upto ALIHAIDER1 to decide....
ASKER
Dear expert pg_india
Ur code is not perfect working. The color of the control is not changed event the mouse move from the control to another. The color remain vbgreen. Pls provide some perfection to aviod using api. will wait for ur response.
Thanks
Ali
Ur code is not perfect working. The color of the control is not changed event the mouse move from the control to another. The color remain vbgreen. Pls provide some perfection to aviod using api. will wait for ur response.
Thanks
Ali
ASKER
Dear expert
pls respond upon my qeury. Kindly do needful because i here is something remains penging here.
Ali
pls respond upon my qeury. Kindly do needful because i here is something remains penging here.
Ali
Hello Ali.
Did my try my example up above?
Thanks,
- Paul
Did my try my example up above?
Thanks,
- Paul
The color of the control is not changed event the mouse move from the control to another????
The color chages whenever the mouse moves out of a control....i don't thk there is any problem with that...
The color chages whenever the mouse moves out of a control....i don't thk there is any problem with that...
ASKER
Ok will try again.
Ali
Ali
ASKER
Dear expert Paul
Your code is working good. But that 's not what i want. Actuly i want to manage this from one subroutine (mouse move).
Thanks for concern
Ali
Your code is working good. But that 's not what i want. Actuly i want to manage this from one subroutine (mouse move).
Thanks for concern
Ali
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That's realy good idea and i will adopt the same.
I will respond early.
Ali
I will respond early.
Ali
Ali, check my response to the other question that you have posted.
private sub lblExam1_mousemove(.......
lblexam1.forecolor=vbgreen
lblexam2.forecolor=vbgray
lblexam3.forecolor=vbgray
end sub
private sub lblExam2_mousemove(.......
lblexam2.forecolor=vbgreen
lblexam1.forecolor=vbgray
lblexam3.forecolor=vbgray
end sub
private sub lblExam3_mousemove(.......
lblexam3.forecolor=vbgreen
lblexam1.forecolor=vbgray
lblexam2.forecolor=vbgray
end sub
You probably want to add the defaults to your Form_MouseMove() too. This will deselect any label you just had your mouse over:
private sub Form_mousemove(.......)
lblexam1.forecolor=vbgray
lblexam2.forecolor=vbgray
lblexam3.forecolor=vbgray
end sub
Hope that helps.