Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Treeview HitTest not firing when dragover target
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
00351086
Message ID:
00351294
Vues:
17
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform