MouseUpWin
Mouse button-up event with window coordinates.
[event]
MouseUpWin([in] short button, [in] short shift, [in] int winX, [in] int winY)
This event will be called when the user releases a mouse button.
Mouse events must be enabled first - see enableMouseEvents
and
enableMouseBtnEvents
.
The event will be called with four arguments:
button
: the mouse button number - one ofvbLeftButton
,vbMiddleButton
, orvbRightButton
shift
: the shift/control/alt bit mask, which contains zero or more bit flags fromvbShiftMask
,vbCtrlMask
, andvbAltMask
winX, winY
: the position where the mouse button was clicked, in window coordinates
convertWindowToPDFCoords2
.
This event is similar to MouseUp2
, except that (a) it is called
with window coordinates instead of PDF coordinates, and (b) it will be
called even if the mouse is clicked outside of a PDF page.
IMPORTANT: In order to receive MouseMoveWin
and MouseUpWin
events when the mouse is outside the
XpdfViewer window (not just outside the PDF pages), you must
call SetCapture
in the MouseDownWin
event handler.
See the example below.
VB:
viewer.enableMouseEvents = True
viewer.enableMouseMoveEvents = True
...
Private Sub viewer_MouseDownWin(button As Integer, shift As Integer, _
winX As Long, winY As Long) _
Handles viewer.MouseDownWin
Dim pg As Long, x As Double, y As Double
viewer.convertWindowToPDFCoords2(winX, winY, pg, x, y)
' ... use pg, x, y ...
' capture the mouse so we receive MoveWin and UpWin events outside the window
SetCapture(viewer.windowHandle)
End Sub
Private Sub viewer_MouseUpWin(button As Integer, shift As Integer, _
winX As Long, winY As Long) _
Handles viewer.MouseUpWin
' release the capture that was initiated in MouseDownWin
ReleaseCapture()
Dim pg As Long, x As Double, y As Double
viewer.convertWindowToPDFCoords2(winX, winY, pg, x, y)
' ... use pg, x, y ...
End Sub
Private Sub viewer_MouseMoveWin(button As Integer, shift As Integer, _
winX As Long, winY As Long) _
Handles viewer.MouseMoveWin
Dim pg As Long, x As Double, y As Double
viewer.convertWindowToPDFCoords2(winX, winY, pg, x, y)
' ... use pg, x, y ...
End Sub
Private Sub viewer_MouseDoubleClickWin(button As Integer, shift As Integer, _
winX As Long, winY As Long) _
Handles viewer.MouseDoubleClickWin
Dim pg As Long, x As Double, y As Double
viewer.convertWindowToPDFCoords2(winX, winY, pg, x, y)
' ... use pg, x, y ...
End Sub