Using Mousemove VBA to show image? (1 Viewer)

phil-007

Registered User.
Local time
Today, 03:57
Joined
Jul 16, 2013
Messages
28
Hi There,

I have a form with mulitple buttons that run different reports, I've used the mousemove VBA script to show text about the report when the cursor is placed over one of the buttons that all works fine.

I'm wondering if using the same idea can you get it to display a image when the cursor is placed over a button.
It'd just be a screenshot of the report output so the user gets an idea of the layout before they run it.

Many Thanks

Phil
 

pr2-eugin

Super Moderator
Local time
Today, 03:57
Joined
Nov 30, 2011
Messages
8,494
As far as I am aware, this is not possible.. I think 'Control Tip Text' is named so for a reason.. ;)

Why not use acPreview, before printing?
 

Mihail

Registered User.
Local time
Today, 05:57
Joined
Jan 22, 2011
Messages
2,373
Take a look to the .Picture property.
You can use the MouseMove event in order to set the .Picture property for Access objects that have this property. (Even the Command Button has this property).
Of course you can display only a static image not a previous for the current report.
 

pr2-eugin

Super Moderator
Local time
Today, 03:57
Joined
Nov 30, 2011
Messages
8,494
Interesting Mhiail, I might be wrong, but with the method you have suggested.. Should the picture

1. Be resized - In which case the preview would be very tiny to even see, thus making it not very helpful,
2. (Or) The button size be huge enough to see the preview - Thus occupying majority of the Form's work space?
 

phil-007

Registered User.
Local time
Today, 03:57
Joined
Jul 16, 2013
Messages
28
HI,

Thanks for your replies. I'm after a solution that works the same as the mousemove feature, so the image appears then disappears when the mouse moves off the button, theres about 12 buttons on the screen so to have the screenshot as the button wouldnt really work.

Thanks for your help
 

Mihail

Registered User.
Local time
Today, 05:57
Joined
Jan 22, 2011
Messages
2,373
In my idea was a SINGLE (small) Picture Box control in the form that show the report "previous" when the mouse is over a button. Maybe all buttons has as background this Picture Box. Maybe the entire form. And so on.

@ Paul
Is very easy to size a picture/control to fit a to a control/picture. The image itself has the properties Width and High (at least in VB6). So simple math to resize. This don't mean that I think to this aspect in my previous post :)
 

phil-007

Registered User.
Local time
Today, 03:57
Joined
Jul 16, 2013
Messages
28
HI Guys,

I think I've cracked it, I just added a image to my form and called it 'pic1' and set it to visable=no.

Then in my VBA code on the same part as the mousemove for the button text I put in:

Code:
Private Sub Contract_Detail_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
helpline.Caption = "These reports will show a breakdown on how a contract is performing, enter the contract ID, then choose if you want to look at a specific week, period or YTD "
pic1.Visible = True
helpline.Visible = True
hiddentext.Visible = False
End Sub

Then I have another section:

Code:
Private Sub Detail_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
helpline.Caption = ""
helpline.Visible = False
pic1.Visible = False
'Me.tbHidden.SetFocus
End Sub

So the image 'pops up' then dissappears when the mouse goes over that particular button, I can just repeat the same logic for the others buttons on screen.

Thanks for your help & ideas.

Phil
 

Mihail

Registered User.
Local time
Today, 05:57
Joined
Jan 22, 2011
Messages
2,373
Good for you.

Just one more idea:
Use a single subroutine in order to show the pic. It is why I talked about the .Picture property.
So, from each button, apply this subroutine with different arguments (the path to the picture that must show for that button)
 

Users who are viewing this thread

Top Bottom