Pointer/Mouse location during slideshow

P

paxdak

Is there a way to determine the mouse location (x,y position) during a
slideshow?

I have a large graphic that I want the user to be able to click on to
enlarge. This works well for graphics that are small relative to the
slide. I can double the graphic size and have it all display on the
slide. In some cases, the graphic takes up most of the slide. Doubling
the size would only show part of the graphic.

I'd like to control how the graphic is enlarged. For example, if the user
clicks in the upper right portion, the graphic would enlarge holding the
upper right corner of the graphic, and grow down/to the left. Basically
it would zoom to the portion of the graphic that the user clicks on. I
could do this by comparing the mouse position relative to the position and
size of the graphic.

The fall back plan is to have 4 transparent boxes overlaid on the graphic
that would control the zoom.

Any help/suggestions would be appreciated.

TIA
 
J

John Wilson

Unless you have fair vba skills I would go with the transparent box idea. If
you know how to use vba you can read the mouse click position like this

Public Const VK_LBUTTON = &H1
Public Type POINTAPI
X As Long
Y As Long
End Type
Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As
Long
Public Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As
Long) As Integer
Option Explicit

Sub mousecursor()
Dim pCur As POINTAPI
Do
If GetAsyncKeyState(VK_LBUTTON) <> 1 Then
If GetAsyncKeyState(VK_LBUTTON) <> 0 Then
Do Until GetAsyncKeyState(VK_LBUTTON) = 0
DoEvents
Loop
GetCursorPos pCur
MsgBox ("x coord:" & pCur.X & ", " & _
"y coord:" & pCur.Y)
Exit Sub
End If
End If
DoEvents
Loop
End Sub
 
P

paxdak

Thanks John. That works great.

I'm just going to use the Function GetCursorPos in my "on click" action
setting for the graphic so it only calls teh function when its needed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top