Control Reference > VSDraw Control > VSDraw Methods > ClientToPage Method (VSDraw) |
Converts mouse coordinates to page coordinates.
[form!]VSDraw.ClientToPage X As Single, Y As Single
Use the ClientToPage method to convert screen coordinates (expressed in twips) to drawing coordinates (defined by the control's ScaleWidth, ScaleHeight, ScaleLeft, and ScaleHeight properties).
Note that the parameters used in mouse events (MouseDown, MouseMove, and MouseUp) are in page coordinates, so this conversion is not necessary when handling these events.
The code below illustrates this method:
' set default scaling values
vd.ScaleWidth = 1000
vd.ScaleHeight = 1000
vd.ScaleLeft = 1000
vd.ScaleTop = 0
' set x,y properties to half of the control
x = vd.Width / 2
y = vd.Height / 2
' convert to scale units
vd.ClientToPage x, y
' half of the control is 1000/2, 1000/2
Debug.Print x y
500 500