Visual Basic Explorer
Visual Basic Explorer
 Navigation
 Home


 Coding
 Source Code

 FAQ Center

 VB Tips

 Downloads

 ToolBox

 Tutorials

 VB Games

 VB News

 VB Award

 VB Forums



 Affiliates
 Planet Source Code

 Rent a Coder

 DirectX4VB


 Misc
 Search

 Feedback

 Advertise

 About


Need to hire
a VB coder?

Please support our sponsor:

 Home 
 Site Map 
 Forums 
 News 
 Feedback 

 

Option Explicit
'--------------------------------------------
'BUTTONS2.VBP August 24, 1999
'Burt Abreu habreu@VBExplorer.com
'
'This project was written to answer a
'FAQ - How to create rollover effects.
'Thanks go to Rod Stephens who cleaned
'up and tweaked the code.
'
'--------------------------------------------

 
Dim MouseOver
Dim MousePress
Dim NewIndex

 
Private Sub ButtonPicture1_MouseDown(Index As Integer, _
Button As Integer, Shift As Integer, X As Single, Y As Single)
If MousePress Then Exit Sub
ButtonPicture1(Index).Picture = DownImage.Picture
lblStatus.Caption = "Mouse Down"
MousePress = True
End Sub

 
Private Sub ButtonPicture1_MouseMove(Index As Integer, _
Button As Integer, Shift As Integer, X As Single, Y As Single)
If MouseOver Then Exit Sub
ButtonPicture1(Index).Picture = OverImage.Picture
lblStatus.Caption = "Mouse Over - Button"
NewIndex = Index
MouseOver = True
End Sub

 
Private Sub ButtonPicture1_MouseUp(Index As Integer, _
Button As Integer, Shift As Integer, X As Single, Y As Single)
If Not MousePress Then Exit Sub
ButtonPicture1(Index).Picture = UpImage.Picture
lblStatus.Caption = "Mouse Up"
MousePress = False
End Sub

 
Private Sub Form_Load()
Dim i As Integer
lblStatus.Caption = "Ready?"
For i = ButtonPicture1.LBound To ButtonPicture1.UBound
ButtonPicture1(i).Picture = UpImage.Picture
Next i
End Sub

 
Private Sub Form_MouseMove(Button As Integer, _
Shift As Integer, X As Single, Y As Single)
If Not MouseOver Then Exit Sub
lblStatus.Caption = "Mouse Over - Form"
MouseOver = False
MousePress = False
ButtonPicture1(NewIndex).Picture = UpImage.Picture
End Sub


Downloads

In IE right-click and select 'Save Target As...' or in Netscape right-click and select 'Save Link As...'

 

View Plain Text View Plain Text
Download Demo Project Download Demo Project
View Code Online Not Available





Home | About | What's New | Source Code | FAQ | Tips & Tricks | Downloads | ToolBox | Tutorials | Game Programming | VB Award | Search | VB Forums | Feedback | VBNews | Copyright & Disclaimer | Advertise | Privacy Policy |

Quick searches: Site Search | Advanced Site Search 

Copyright 2002 by Exhedra Solutions, Inc.
By using this site you agree to its terms and conditions
VB Explorer and VBExplorer.com are trademarks of Exhedra Solutions, Inc.