?
Solved

image - button when mouse pass

Posted on 1998-10-19
5
Medium Priority
?
147 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 150 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Suggested Courses
Course of the Month12 days, 13 hours left to enroll

777 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