MouseMove2
Mouse movement event.
[event]
MouseMove2([in] short button, [in] short shift, [in] int page, [in] double x, [in] double y)
This event will be called when the user moves the mouse.
Mouse events must be enabled first - see enableMouseEvents
and
enableMouseMoveEvents
.
The event will be called with five arguments:
button
: the mouse button number - one ofvbLeftButton
,vbMiddleButton
, orvbRightButton
; or 0 if no button is pressedshift
: the shift/control/alt bit mask, which contains zero or more bit flags fromvbShiftMask
,vbCtrlMask
, andvbAltMask
page
: the page number where the mouse pointer is locatedx, y
: the position where the mouse pointer is located, in PDF coordinates
VB:
' this implements a mouse-pan feature with the left button
viewer.enableMouseEvents = True
panSpeed = 2
...
Private Sub viewer_MouseDown2(button As Integer, shift As Integer, _
page As Long, x As Double, y As Double) _
Handles viewer.MouseDown2
If button = 1 Then
viewer.convertPDFToWindowCoords2(page, x, y, panX, panY)
End If
End Sub
Private Sub viewer_MouseMove2(button As Integer, shift As Integer, _
page As Long, x As Double, y As Double) _
Handles viewer.MouseMove2
Dim wx As Long, wy As Long
If button = 1 Then
viewer.convertPDFToWindowCoords2(page, x, y, wx, wy)
viewer.scrollBy(-panSpeed * (wx - panX), -panSpeed * (wy - panY))
panX = wx
panY = wy
End If
End Sub