Information générale
Catégorie:
Gestionnaire d'écran & Écrans
Hello Again:
I included the following code in the Load Event of my form:
*
* The ActiveX control dual interface (VTABLE binding) is an optimization
* supported by Visual FoxPro. If an ActiveX control doesn’t use the dual
* interface, you can disable the optimization while using that control.
*
* Disable ActiveX Control Dual Interface
*
=Sys(2333,0)
*
* Calculate the conversion between VFP window units (in pixels) and
* TreeView window units (in twips)
*
Local ;
liHWnd, ;
liHDC, ;
liPixelsPerInchX, ;
liPixelsPerInchY, ;
;
lcItem
*
* Define some contants
*
#Define cnLog_Pixels_X 88
* from WINGDI.H
#Define cnLog_Pixels_Y 90
* from WINGDI.H
#Define cnTwips_Per_Inch 1440
* 1440 twips per inch
*
* Declare some Windows API functions
*
Declare integer GetActiveWindow in WIN32API
Declare integer GetDC in WIN32API ;
integer iHDC
Declare integer GetDeviceCaps in WIN32API ;
integer iHDC, integer iIndex
*
* Get a device context for VFP
*
liHWnd = GetActiveWindow()
liHDC = GetDC(liHWnd)
*
* Get the pixels per inch
*
liPixelsPerInchX = GetDeviceCaps(liHDC, cnLog_Pixels_X)
liPixelsPerInchY = GetDeviceCaps(liHDC, cnLog_Pixels_Y)
With ThisForm
*
* Get the twips per pixel
*
.nTreeFactorX = cnTwips_Per_Inch / liPixelsPerInchX
.nTreeFactorY = cnTwips_Per_Inch / liPixelsPerInchY
EndWith
**************
Here is a sample of my HitTest() placed in the OleDragDrop Event:
LPARAMETERS data, effect, button, shift, x, y
Private ;
lcCategory, ;
lcNodeParent, ;
;
lnX, ;
lnY, ;
;
loNewNode, ;
loNode
With Thisform
If Not Empty( .cDraggedNodeKey )
* Convert X & Y to twips (TreeView window units)
lnX = X * .nTreeFactorX
lnY = Y * .nTreeFactorY
loNode = .OleTree.HitTest( lnX, lnY )
If Not IsNull( loNode )
******
Hope this helps!
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement