|
-
Aug 25th, 2007, 09:05 PM
#1
Thread Starter
Member
[RESOLVED] Mouse Over Picture Change
Hi, could anybody help me with some few source code of understanding and help me a little of simple troubleshooting. I'm not a VB6 expert though. Well, it goes like this. I wanted to create a source code where mouse pointer points at the image1, image1 change to image2. when mouse pointer is not on the image1, it change back to image1. I've been trying to figure out by using the image1_movemouse event thing. It changes when my mouse is on the image, but doesnt change back when my mouse is not on it. Any logic behind which i could include? And the source code which i dont understand is the .tag , .mousepointer and .mouseicon command. I know that the pointer is ur mouse pointer and icon is to change ur mouse icon. But is it related to the mousemove event. Anyway, hope to hear some advice soon. Thanks in advance.
-
Aug 25th, 2007, 09:48 PM
#2
Re: Mouse Over Picture Change
Is this using the Image control or a PictureBox?
With a PictureBox you could use the WindowFromPoint() API function. Otherwise, the best way is subclassing.
But a simple solution is this:
Code:
Option Explicit
Private bolInside As Boolean
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If bolInside Then
bolInside = False
Image1.Picture = LoadPicture("C:\image1.bmp")
End If
End Sub
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'So it only updates once and not everytime mouse moves.
If Not bolInside Then
bolInside = True
Image1.Picture = LoadPicture("C:\hover_img.bmp")
End If
End Sub
You'll need to change the path to the images to match the ones in your program. Alternatively, you could just use 2 image controls and show/hide the 2nd one.
-
Aug 25th, 2007, 09:54 PM
#3
Thread Starter
Member
Re: Mouse Over Picture Change
I'm using an image control. What is bolInside means? is it a statement or a command ? Sorry for asking though. I'm a newbie...
-
Aug 25th, 2007, 09:55 PM
#4
Thread Starter
Member
Re: Mouse Over Picture Change
oops... sorry... didnt read the defining the statement part at the private. Understood.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|