>lc = data.getdata(1) >lnXFactor = 1440/96*(13/FONTMETRIC(1, "Arial", 10, "B")) >lnYFactor = 1440/96*(13/FONTMETRIC(7, "Arial", 10, "B")) >lc2 = this.hitTest(x * lnXFactor, y * lnYFactor) >Here's the method I use to get lnXFactor and lnYFactor:
local liHWnd, ; liHDC, ; liPixelsPerInchX, ; liPixelsPerInchY #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) * Get the twips per pixel. lnTreeFactorX = cnTWIPS_PER_INCH/liPixelsPerInchX lnTreeFactorY = cnTWIPS_PER_INCH/liPixelsPerInchYThis works reliably for me.
_VFP.AutoYield = .F. sys(2333, 0)Doug