ImageToClient Method
Translates the coordinates of a point on the specified page of the displayed document to viewer control (client) coordinates.
expression.ImageToClient(nPage, lX, lY, plSX, plSY)
*expression * Required. An expression that returns an MiDocView object.
nPage Required Long. The zero-based page number of *lX * and lY.
lX Required Long. The horizontal image coordinate on the specified page to translate.
lY Required Long. The vertical image coordinate on the specified page to translate.
plSX Required Long. A variable that receives the horizontal client coordinate.
plSY Required Long. A variable that receives the vertical client coordinate.
Remarks
The ImageToClient method translates the coordinates in pixels of a a point on the specified page in the displayed document to viewer control (client) coordinates. For example, if you scroll the document upward a small distance vertically in the viewer control, without scrolling horizontally, and pass in an nPage value of 0 (zero), an lX value of 0 (zero), and an lY value of 100, the ImageToClient method may return a plSX value of 0 (zero) and plSY value of -300. This indicates that the point 100 pixels below the top of the first page of the scrolled document is now 300 pixels above the top of the viewer control window.
Example
The following example translates the coordinates 0, 100 on the first page (page 0) of the displayed document to viewer control (client) coordinates.
Sub TestClientToDocument()
Dim xCli As Long, yCli As Long
Dim lngPage As Long
Dim xImg As Long, yImg As Long
lngPage = 0
xImg = 0
yImg = 100
MiDocView1.ImageToClient lngPage, xImg, yImg, xCli, yCli
MsgBox "Image to client coordinates:" & vbCrLf & _
" Image Page: " & lngPage & vbCrLf & _
" Image X: " & xImg & vbCrLf & _
" Image Y: " & yImg & vbCrLf & _
" Client X: " & xCli & vbCrLf & _
" Client Y: " & yCli, _
vbInformation + vbOKOnly, _
"ImageToClient Translation"
End Sub
Applies to | MiDocView Object