General information
Category:
ActiveX controls in VFP
The HitTest method expects the co-ordinates to be in TWIPS. The following extract should give you the general idea:-
*** ActiveX Control Event ***
LPARAMETERS data, effect, button, shift, x, y, state
LOCAL loDropNode
loDropNode = This.HitTest(x * lnTwipsX, y * lnTwipsY)
if vartype(loDropNode) $ "O"
*!* loDropNode is a valid node object.
else
*!* loDropNoed is NOT a valid node object.
endif
The next example illustrates how to get the lnTwipsX and lnTwipsY values using the Windows API:-
LOCAL lnHWND
LOCAL lnHDC
LOCAL lnPixelsPerInchX
LOCAL lnPixelsPerInchY
*!* Pinch some constants from WINGDI.H
#define LOG_PIXELS_X 88
#define LOG_PIXELS_Y 90
#define TWIPS_PER_INCH 1440
declare integer GetDeviceCaps in WIN32API INTEGER lnHDC, INTEGER lnIndex
declare integer GetActiveWindow in WIN32API
declare integer GetDC in WIN32API INTEGER lnHDC
lnHWND = GetActiveWindow()
lnHDC = GetDC(lnHWND)
lnPixelsPerInchX = GetDeviceCaps(lnHDC, LOG_PIXELS_X)
lnPixelsPerInchY = GetDeviceCaps(lnHDC, LOG_PIXELS_Y)
lnTwipsX = TWIPS_PER_INCH / lnPixelsPerInchX
lnTwipsY = TWIPS_PER_INCH / lnPixelsPerInchY
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only