在表单上添加1个容器控件Container1
右键点击Container1,在弹出的菜单中选“编辑”
在Container1中添加标签控件label1
在表单中添加微调控件,假设其名为spinner1,将其value值设置为1(秒)
在表单上添加计时器控件timer1
将timer1的interval值设置为500(也就是0.5秒,可根据需要设置)
将timer1的Enabled属性值设置为.F.
其timer代码如下:
thisform.Container1.label1.left=thisform.Container1.label1.left-1
if thisform.Container1.label1.left<1
thisform.Container1.label1.left=thisform.Container1.width
endif
this.interval=thisform.spinner1.value*1000
在表单上天加两个命令按钮
其中command1的Caption属性设置为“开始”
其click代码如下:
thisform.timer1.enabled=.T.
其中command2的Caption属性设置为“关闭”
其click代码如下:
thisform.timer1.enabled=.F.