虽然我只是团小组长,但我觉得下面这个示例是正确的
oForm = Createobject("TestForm")
oForm.Show(1)
Return
Define Class TestForm As Form
Height = 400
Width = 400
AutoCenter = .T.
xOffSet = 0
yOffSet = 0
Caption = "拖拉图像移动到该位置"
Add Object Image1 As Image With;
Height = 200, Width = 200, Top = 20, Left = 20, Stretch = 1, ;
Picture = Getpict("JPG|GIF", "图像文件", "确定") && 选择一个图像文件
Procedure Image1.MouseMove
Lparameters nButton, nShift, nXCoord, nYCoord
If nButton = 1
Thisform.xOffSet = nXCoord - This.Left
Thisform.yOffSet = nYCoord - This.Top
This.Drag
Endif
Endproc
Procedure Image1.DragDrop
Lparameters oSource, nXCoord, nYCoordgDrop
This.Parent.DragDrop(oSource, nXCoord, nYCoordgDrop)
Endproc
Procedure DragDrop
Lparameters oSource, nXCoord, nYCoord
oSource.Left = nXCoord - Thisform.xOffSet
oSource.Top = nYCoord - Thisform.yOffSet
Endproc
Enddefine