#define cnLOG_PIXELS_X 88 #define cnLOG_PIXELS_Y 90 #define cnTWIPS_PER_INCH 1440 local liHWnd, ; liHDC, ; liPixelsPerInchX, ; liPixelsPerInchY * Declare some Windows API functions. declare integer GetDC in Win32API ; integer iHDC declare integer GetDeviceCaps in Win32API ; integer iHDC, integer iIndex declare integer ReleaseDC in Win32API ; integer ihWnd, integer iHDC * Get a device context for VFP. liHWnd = _vfp.hWnd liHDC = GetDC(liHWnd) * Get the pixels per inch. liPixelsPerInchX = GetDeviceCaps(liHDC, cnLOG_PIXELS_X) liPixelsPerInchY = GetDeviceCaps(liHDC, cnLOG_PIXELS_Y) * Get the twips per pixel. with This .nTreeFactorX = cnTWIPS_PER_INCH/liPixelsPerInchX .nTreeFactorY = cnTWIPS_PER_INCH/liPixelsPerInchY endwith * Clean up. ReleaseDC(liHWnd, liHDC) clear dlls GetDC, GetDeviceCaps, ReleaseDCNow in the TreeView's MouseDown method, you can do something like this:
loNode = This.HitTest(nXCoord * Thisform.nTreeFactorX, ; nYCoord * Thisform.nTreeFactorY) * do something with loNode, such as storing it in a propertyDoug