Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image change on mouse over

Status
Not open for further replies.

EdmCath

Technical User
Jun 22, 2004
34
CA
I am now trying to figure out reports. I dont like the standard windows buttons so I decided to make my own using images. I thought it would be as simple as a media player skin, but I guess not. What I want to do is have a standard button, when I move the mouse over it, it would glow and when I click, it would depress. I have it kind of working, but when I move the mouse off of the button, it still glows. Also, how would I write the code to make this work globally with all images.

Here is the code I currently have.

Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
image1.Visible = False
Image2.Visible = True
Image3.Visible = False
End Sub

Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
image1.Visible = True
Image2.Visible = False
Image3.Visible = False
End Sub

Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
image1.Visible = False
Image2.Visible = False
Image3.Visible = True
End Sub

Any help is greatly appreciated.

Murray Johnson
Edmonton Catholic Schools
 
Hi, considering you are using MouseMove, you might try using a stacked two button approach where the primary button has Mouse Move and Click Events, and the Secondary Button has an image of a Depressed Button:

cmdUp 'Primary Button
cmdDown 'Secondary Button Set Invisible

cmdUp on MouseMove:
Me.cmdUp.Picture = "C:\BMPs\Image2.bmp" 'Glowing

cmdUp on Click:

'do something

me.CmdDown.Visible = True
me.cmdDown.SetFocus
me.CmdUp.Picture = "C:\BMPs\Image1.bmp" 'Default Picture
me.cmdUp.Visible = False

cmdDown on Click: 'Use an Image of a Depressed Button

'do something

me.cmdUp.Visible = True
me.cmdUp.SetFocus
me.cmdDown.Visible = False

I did not test it, but it should work. To do something globally, you might do a search on Tag Properties and look for posts by Fancy Prairie. He has several good examples.

Hope that Helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top