This content is not currently approved and is visible here for review only.

Library code snippets

Mouse Over In VB6 Code

Page 1 of 2
  1. Mouse Over In VB6 Code
  2. MouseOver

Mouse Over In VB6 Code

'Simulating HTML/Javascript type MouseOver Effect in VB

'VB6 Code by LordRage [Inya-Agha Gabriel]
'www.thequickeninggroup.com
'For support email gabey@justice.com

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

Comments

  1. 01 Jan 1999 at 00:00

    This thread is for discussions of Mouse Over In VB6 Code.

Leave a comment

Sign in or Join us (it's free).

AddThis