DocumentToClient Method

Translates the specified coordinates of the displayed document to viewer control (client) coordinates.

expression.DocumentToClient(plX, plY)

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

plX    Required Long. A variable that specifies the x-axis document coordinate and returns the equivalent x-axis viewer control (client) coordinate.

plY    Required Long. A variable that specifies the y-axis document coordinate and returns the equivalent y-axis viewer control (client) coordinate.

Remarks

The DocumentToClient method translates the specified coordinates in pixels of 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 the values 100, 100, the DocumentToClient method may return a plX value of 0 (zero) and a plY value of -225. This indicates that the viewer and the document are aligned horizontally, but that 100 pixels from the top of the document is 225 pixels vertically above the top of the viewer control.

Example

The following example translates the displayed document coordinates 100, 100 to viewer control (client) coordinates.

Sub TestDocumentToClient()
  
  Dim x As Long, y As Long
  x = 100
  y = 100
  
  MiDocView1.DocumentToClient x, y
  MsgBox "Document to client coordinates:" & vbCrLf & _
    " Document X of 100 = Client X of " & x & vbCrLf & _
    " Document Y of 100 = Client Y of " & y
    
End Sub

Applies to | MiDocView Object