GefScreen.PixelsToTwipsPos (method)

Converts a position from pixels to TWIPS in the current GefScreen.
Syntax: object.PixelsToTwipsPos X, Y
Parameters:
X As long* -
Y As long* -
Description: Converts a position from pixels to TWIPS in the current GefScreen.

Examples

Type POINTAPI
  x As Long
  y As Long
End Type
Declare Function GetCursorPos Lib "user32" Alias "GetCursorPos" (lpPoint As POINTAPI) As Long
 
Sub OnKeyDown(key As Integer)
  Dim curPos As POINTAPI
  Dim retVal As Long
  retVal = GetCursorPos(curPos)
  Dim x As Long
  Dim y As Long
  x = curPos.x
  y = curPos.y
  CimGetScreen.PixelsToTwipsPos x, y
  If x > CimGetObject.Left _
  And x <= (CimGetObject.Left + CimGetObject.Width) _
  And y < CimGetObject.Top _
  And y >= (CimGetObject.Top - CimGetObject.Height) Then
    MsgBox "mouse is over object"
  End If
End Sub
See Also: PixelsToTwipsSize , TwipsToPixelsPos , TwipsToPixelsSize