General information
Category:
Forms & Form designer
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!
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