2,727
社区成员
发帖
与我相关
我的任务
分享
Public frm
frm=Createobject("myform")
frm.Show
Define Class myform As Form
AutoCenter = .T.
Height = 121
Width = 276
DoCreate = .T.
Caption = "玩笑按钮(按钮的复用技术)"
Name = "Form1"
Add Object command1 As CommandButton With ;
Top = 36, ;
Left = 48, ;
Height = 48, ;
Width = 180, ;
Caption = "新建 修改 删除 确定 取消", ;
Name = "Command1"
Add Object shape1 As Shape With ;
Top = 36, ;
Left = 0, ;
Height = 48, ;
Width = 36, ;
BackStyle = 1, ;
BorderStyle = 1, ;
DrawMode = 11, ;
FillStyle = 1, ;
Name = "Shape1"
Procedure Paint
Thisform.shape1.Refresh
Endproc
Procedure command1.MouseDown
Lparameters nButton, nShift, nXCoord, nYCoord
For i=1 To 5
If nXCoord < (7+(i-1)*3)*12
Thisform.shape1.Left= (1+3*i)*12
This.Tag = Substr(This.Caption, 7*i-6,4)
Exit
Endif
Endfor
Endproc
Procedure command1.MouseUp
Lparameters nButton, nShift, nXCoord, nYCoord
Thisform.shape1.Left=0
Thisform.Caption = [你选择了"]+This.Tag+["!]
Endproc
Enddefine