>>*** OLE Control Event *** MosueDown >>LPARAMETERS button, shift, x, y >>oHitTest = THIS.HitTest( X * THISFORM.nXTwips, Y * THISFORM.nYTwips ) >>if type("oHitTest")= "O" and !isnull(oHitTest) >> this.SelectedItem = oHitTest >>endif >>oHitTest = .null. >> >>* OleStartDrag >>*** ActiveX Control Event *** >>LPARAMETERS data, allowedeffects >>data.Setdata(this.SelectedItem.Key) >> >>* Tree2 OleDragOver >>*** OLE Control Event *** >>LPARAMETERS data, effect, button, shift, x, y, state >>oHitTest = THIS.HitTest( X * THISFORM.nXTwips, Y * THISFORM.nYTwips ) >>if type("oHitTest")= "O" >> THIS.DropHighLight = oHitTest >>endif >> >> >>* Tree2 OleDragDrop >>*** ActiveX Control Event *** >>Lparameters data, effect, button, shift, x, y >>If Data.Getformat(1) &&CF_TEXT >> If type("this.DropHighLight") = "O" and !isnull(this.DropHighLight) >> lcKey = Data.GetData(1) >> loNode = thisform.OleTreeview.nodes(lcKey) >> wait window "Dropped "+loNode.Text+" on "+this.DropHighLight.text >> Endif >>Endif >>This.DropHighLight = .null. >> >> >>* Code setting form nX,nyTwips ( do not use constants like 15 or 1440/96 for this ) >>*-- Code for PixelToTwips method >>LOCAL liHWnd, liHDC, liPixelsPerInchX, liPixelsPerInchY >>* Define some constants. >> >>#DEFINE cnLOG_PIXELS_X 88 >>#DEFINE cnLOG_PIXELS_Y 90 >>#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. >>THISFORM.nXTwips = ( cnTWIPS_PER_INCH / liPixelsPerInchX ) >>THISFORM.nYTwips = ( cnTWIPS_PER_INCH / liPixelsPerInchY ) >> >>>>Cetin