How do I Change Picture on Mouse Move

Morgandy

Registered User.
Local time
Today, 09:17
Joined
Nov 29, 2008
Messages
42
I've been looking for a way to do this unsuccessfully. I'm running Access 2007 on Vista. How do I change a command button's Picture on a Mouse Move and Mouse Down...creating a rollover effect.
 
To set the rollover graphic
Code:
Private Sub CommandButtonName_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 CommandButtonName.Picture = "C:\Picture Files\RollOver.gif"
End Sub
To set the "normal" graphic
Code:
Private Sub Detail_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 CommandButtonName.Picture = "C:\Picture Files\NonRollOver.gif"
End Sub
 
thank you. I love people that know java. What is the difference between the non rollover graphic and a roll over graphic?
 
Ok It's not working. I put in the following

Private Sub button1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
button1.Picture = "C:\...\images\ButtonUpLeft.gif"
End Sub

Private Sub button1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
button1.Picture = "C:\...\images\ButtonUpLeft.gif"
End Sub

Private Sub button1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
button1.Picture = "C:\...\images\ButtonUpLeft.gif"
End Sub


But it does not do anything when I run the form. Is there a setting I have to have on for it to work?
 
Forget the MouseUp and MouseDown events, they're not needed. You need to add the code given for MouseMove of the Detail section. This change he picture back to the defaut wehen the moue moves off of the command button.

I suspect your problem is that code does not run in 2007 unless your database resides in a folder that has been declared a “trusted” location.

To trust your folder, click:

Office Button (top left)
Access Options (bottom of dialog)
Trust Center (left)
Trust Center Settings (button)
Trusted Locations (left)
Add new location (button)

The RollOver graphic is the picture you want to appear when the mouse is over the button; thNonRollOver graphic is the picture you want to appear when the mouse is not over the button.
 
Last edited:
Is there a way to get rid of the hyperlink lines when you select the button? Probably not but if there is it would look better.
 
What do you mean "hyperlink lines?" Can you post a screenshot?
 
do I have to have the picture on the net to post it here?

I'm talking about the selection lines that appear when you click on the command button.

Also, since doing the coding for the rollovers whenever I open the form it flashes several times before going to normal. Any solutions?
 
do I have to have the picture on the net to post it here?
No, you can just attach a pic by using the Manage Attachments button when you are in Advanced Edit mode here.

I'm talking about the selection lines that appear when you click on the command button.
I don't think that you can get rid of that. That is a Windows feature unless perhaps you try unchecking the Use Windows Themed Controls.

Also, since doing the coding for the rollovers whenever I open the form it flashes several times before going to normal. Any solutions?
Remove the mouse move code. It will tend to do that and I don't think you can do anything but just not use the functionality to keep it from doing that. I don't use that feature as it does do weird things at times.
 
kk thanks...Does the Got Focus option do the same thing?
 
ahhh...well I suppose as long as it only spazes out when it opens I can live with it. Thanks again for all the help
 

Users who are viewing this thread

Back
Top Bottom