ComponentOne VSView 8.0
ClientToPage Method (VSPrinter)

Converts mouse coordinates to page coordinates.

Syntax

[form!]VSPrinter.ClientToPage X As Single, Y As Single, [ Page As Variant ]

Remarks

Use the ClientToPage method to convert the coordinates on the MouseDown, MouseMove, and MouseUp events into page coordinates, in twips.

For example, if the user clicks in the middle of an 8.5x11 page in the preview window, the X and Y parameters in the MouseDown event would depend on the zoom factor and page position within the control. After converting to page coordinates, you would have X = 6120 (8.5/2 * 1440) and Y = 7920 (11/2 * 1440).

This may be useful if you want to determine that the user clicked the mouse on a specific page element such as a field on a form.

The optional parameter Page returns the number of that page that was clicked. If only a single page is being displayed, the value returned will be the value of the PreviewPage property. If multiple pages are being displayed, the value returned will be the number of the page that was clicked. (Multiple pages are displayed when the ZoomMode property is set to zmTwoPages or zmThumbnail).

You can perform the reverse conversion using the PageToClient method.

For example, the following code prints the page coordinates of each click:

Private Sub vp_MouseDown(Button As Integer, Shift As Integer, _

                         X As Single, Y As Single)

    Dim page

    vp.ClientToPage X, Y, page

 

    Debug.Print "You clicked on page "; page; " at "; _

                X / 1440; " inches from the top and "; _

                Y / 1440; " inches from the left."

End Sub

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback