Solved

image - button when mouse pass

Posted on 1998-10-19
5
135 Views
Last Modified: 2010-04-30
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?
0
Comment
Question by:victorlong
  • 3
  • 2
5 Comments
 
LVL 14

Accepted Solution

by:
waty earned 50 total points
Comment Utility
You have to add code in your MouseMove event of your form.

Do as follow :

Declare a global variable ex : gbOverImage

in the MouseMove of your form, add this
if gbOverImage then
   ' *** Set your image properly

   gbOverImage= False
end if

in the MouseMove of your image
gbOverImage= True


I have done this way some years ago for something similar
0
 

Author Comment

by:victorlong
Comment Utility
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.
0
 
LVL 14

Expert Comment

by:waty
Comment Utility
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.
0
 

Author Comment

by:victorlong
Comment Utility
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.
0
 
LVL 14

Expert Comment

by:waty
Comment Utility
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.

0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now