VFP新技术推广

Ilikefox Ilikefox 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
列位,此帖纯粹是玩笑帖,发个所谓命令按钮的复用技术,切不可用于实际,呵呵。
复制以下代码,保存为prg文件,运行之。(以此向版主及foxer们问好)

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
...全文

相关推荐

评论 22
收藏 已收藏
分享
返回顶部
Ilikefox
VFP 2,750 成员 29,142 内容