如何移动控件
我建立了一个表单,表单内创建了一个CONTAINER的类,容器类里面放了一个shape,铺满了整个容器,我想要的效果是如果用鼠标可以在让容器表单内四处移动,调整位置,请问怎么弄?
1.zip
(2.53 KB)
[此贴子已经被作者于2020-11-16 10:46编辑过]
of = CREATEOBJECT("form1") of.show(1) RETURN DEFINE CLASS form1 as form ADD OBJECT con1 as con WITH left=10,top=10 ENDDEFINE DEFINE CLASS con as Container nX = 0 nY = 0 PROCEDURE MouseDown(nButton, nShift, nXCoord, nYCoord) this.nX = this.left - nXCoord this.nY = this.top - nYCoord ENDPROC PROCEDURE MouseMove(nButton, nShift, nXCoord, nYCoord) IF nButton==1 this.left = this.nX + nXCoord this.top = this.nY + nYCoord ENDIF ENDPROC ENDDEFINE