回复 8楼 FunnyClown
** test.prgof = CREATEOBJECT("form1")
of.show(1)
DEFINE CLASS form1 AS form
ADD OBJECT shape1 AS shape WITH Top=10,Left=10,Height=70,Width=70,Curvature=99
ADD OBJECT timer1 AS timer WITH Interval=500
mTop = 0
mLeft = 0
PROCEDURE init
this.mTop = this.Height - this.shape1.Height
this.mLeft = this.Width - this.shape1.Width
ENDPROC
PROCEDURE timer1.Timer
thisform.shape1.top = INT(thisform.mTop * RAND())
thisform.shape1.left = INT(thisform.mLeft * RAND())
ENDPROC
ENDDEFINE
**上面的是.PRG文件,你把上面的保存为 test.prg直接运行
** 如果你是在表单中的,那就这样
** 表单的 INIT中
PUBLIC mTop,mLeft
mTop = thisform.Height - thisform.shape1.Height
mLeft = thisform.Width - thisform.shape1.Width
** 在Timer1.Timer中
thisform.shape1.top = INT(mTop * RAND())
thisform.shape1.left = INT(mLeft * RAND())