Solved

image - button when mouse pass

Posted on 1998-10-19
5
143 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 14

Accepted Solution

by:
waty earned 50 total points
ID: 1440618
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
ID: 1440619
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
ID: 1440620
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
ID: 1440621
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
ID: 1440622
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

734 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