Link to home
Start Free TrialLog in
Avatar of victorlong
victorlong

asked on

image - button when mouse pass

In VB5 disign window, when the mouse cursor sets on an icon of a toolbar, the icon becomes a button, and back to the plain icon when the mouse leaves the place.

I want to do this for an image.

I tried to use Mousepass event of the image to display the button and that looks fine, but I got no good way to let it disapear when the mouse leave the image.

Any good idea?
ASKER CERTIFIED SOLUTION
Avatar of waty
waty
Flag of Belgium image

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
Avatar of victorlong
victorlong

ASKER

Hi Waty

Thank you.

In my case, there are many other controls on the form. So, not only the form, I need put the mousemove event for each control as well, and I may forget to put such code for a newly added control.

I wish we have a MouseLeave event for the image....Can we create an ActiveX control with this event?

Cheers.
You could write a new Image OCX implementing this events.
It should be possible.

Another possibility, is store the hwnd of the image you are working on, add a timer, and check in that timer the control under the mouse position. I have seen something like that some years ago.
Hi Waty

Image OCX is interesting. But there are at least two problems:

1. The base of an ActiveX control is a form which is not an image stype....for example, you may not see the background.
2. Still have the problem how to make the Sub Mouse_Leave.
In the OCX, you could add a timer wich check the hwnd of the current hwnd where the mouse is over. If this is not the same of the hwnd of your created activex, your generate a Leave event, otherwise nothing.