在表单运行时如何建立方法
表单运行时,我在一个容器中添加了一个shape控件,我想在同时写代码到该控件的dragdrop中,不知道怎么办?不要绑定的方法
程序代码:*test.prg
of = CREATEOBJECT("myForm")
of.show
READ EVENTS
CLEAR ALL
RETURN
DEFINE CLASS myForm as Form
ADD OBJECT cmd as commandbutton WITH top=10,left=10,height=22,caption="test"
PROCEDURE Unload
CLEAR EVENTS
ENDPROC
PROCEDURE cmd.Click
IF VARTYPE(thisform.Shape1) == "U"
thisform.AddObject("Shape1", "myShape", 20,150,100,40, 0,0, 100,0, 100,100, 0,100)
thisform.AddObject("Shape2", "myShape", 60,150,100,40, 0,50, 50,0, 100,50, 50,100)
thisform.AddObject("Shape3", "myShape", 100,150,100,40, 0,0, 100,0, 50,100, 0,0)
ENDIF
ENDPROC
ENDDEFINE
DEFINE CLASS myShape as Shape
Visible = .T.
DIMENSION aPoly[4,2]
PROCEDURE Init(Top,Left,Width,Height, x1,y1, x2,y2, x3,y3, x4,y4)
IF !EMPTY(Width)
this.myPolyPoints(Top,Left,Width,Height, x1,y1, x2,y2, x3,y3, x4,y4)
ENDIF
ENDPROC
PROCEDURE myPolyPoints(Top,Left,Width,Height, x1,y1, x2,y2, x3,y3, x4,y4)
Visible = .F.
this.Top = Top
this.Left = Left
this.Width = Width
this.Height = Height
this.aPoly[1,1] = x1
this.aPoly[1,2] = y1
this.aPoly[2,1] = x2
this.aPoly[2,2] = y2
this.aPoly[3,1] = x3
this.aPoly[3,2] = y3
this.aPoly[4,1] = x4
this.aPoly[4,2] = y4
this.PolyPoints = "this.aPoly"
Visible = .T.
ENDPROC
ENDDEFINE