ClientToImage Method

Translates viewer control (client) coordinates to the page number and coordinates of a point on an image in the displayed document.

expression.ClientToImage(lSX, lSY, pnPage, plX, plY)

*expression   * Required. An expression that returns an MiDocView object.

lSX    Required Long. The horizontal client coordinate to translate.

lSY    Required Long. The vertical client coordinate to translate.

pnPage    Required Long. A variable that receives the zero-based page number.

plX    Required Long. A variable that receives the horizontal image coordinate.

plY    Required Long. A variable that receives the vertical image coordinate.

Remarks

The ClientToImage method translates the coordinates in pixels of the viewer control (the client) to the page number and coordinates of a point on an image in the displayed document. For example, if you scroll the document upward a small distance vertically in the viewer control, without scrolling horizontally, and pass in an lSX value of 0 (zero) and an lSY value of 100, the ClientToImage method may return a pnPage value of 0 (zero), a plX value of 0 (zero), and a plY value of 1300. This indicates that 100 pixels from the top of the viewer control window translates to 1300 pixels from the top of the first page of the scrolled document.

Example

The following example translates the viewer control (client) coordinates 0, 100 to the page number and coordinates of an image in the displayed document.

Sub TestClientToImage()
  
  Dim xCli As Long, yCli As Long
  Dim lngPage As Long
  Dim xImg As Long, yImg As Long
  
  xCli = 0
  yCli = 100
  
  MiDocView1.ClientToImage xCli, yCli, lngPage, xImg, yImg
  MsgBox "Client to image coordinates:" & vbCrLf & _
    " Client X: " & xCli & vbCrLf & _
    " Client Y: " & yCli & vbCrLf & _
    " Image Page: " & lngPage & vbCrLf & _
    " Image X: " & xImg & vbCrLf & _
    " Image Y: " & yImg, _
    vbInformation + vbOKOnly, _
    "ClientToImage Translation"
    
End Sub

Applies to | MiDocView Object