'Simulating HTML/Javascript type MouseOver Effect in VB
'VB6 Code by LordRage [Inya-Agha Gabriel]
'www.thequickeninggroup.com
'For support email [email protected]
Option Explicit
Dim intIndex As Integer
Dim Mouseover As Boolean
Private Sub ButtonPicture1_MouseMove(index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
'Test to determine if Mouseover is true, else load picture and set mouseover to true
'This will prevent the picture box from continually reloading the pictures, thus flickering
If Mouseover Then
Exit Sub
Else
'Load picture based on their tag values
ButtonPicture1(index).Picture = LoadPicture("Images\" & ButtonPicture1(index).Tag & "1.jpg")
'Assign the value of index to a variable that will retain the value of index even when this procedure has ended
intIndex = index
Mouseover = True
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'Once the mouse leaves the picture space, wherever its coordinates are captured
'on the form triggers the swapimage event.
'However, we test for mouseover to ensure that once the defaultimage has been
'restored the swapimage event will not be triggered again until it moves over another picture.
If Mouseover Then
ButtonPicture1(intIndex).Picture = LoadPicture("Images\" & ButtonPicture1(intIndex).Tag & ".jpg")
Mouseover = False
End If
End Sub
Enter your message below
Sign in or Join us (it's free).