表单问题
在字幕效果表单界面,当点击“移动”按钮时。标签从左到右移动,移出窗口后,从窗口右侧处想继续向左移动,同时按钮上的文字“移动”变为“暂停”,当单击“暂停”时,标签停止移动。并且子的颜色不停的变化。新建一个表单,放一个按钮控件,其CAPTION为“暂停”,一个标签控件,其属性为“欢迎光临”,一个计时器控件,其INTERVAL属性为50。
计时器的TIMER时间代码为:
if thisform.label1.left< 0-thisform.label1.width
thisform.label1.left=thisform.width
endif
thisform.label1.left=thisform.label1.left-3
a=1+int(rand()*254)
b=1+int(rand()*254)
c=1+int(rand()*254)
thisform.label1.forecolor=rgb(a,b,c)
按钮的CLICK时间代码为:
if thisform.timer1.enabled=.t.
this.caption="移动"
thisform.timer1.enabled=.f.
else
this.caption="暂停"
thisform.timer1.enabled=.t.
endif
其中能解释一下计时器的TIMER时间代码意思吗?
[img]E:\1.BMP[/img]
[[it] 本帖最后由 清逸少年 于 2008-3-23 12:47 编辑 [/it]]
表单问题
注意:在thisform.timer1中有个属性是 Interval 表示调用计时器间隔时间,单位是毫秒每经过Interval属性设定的间隔时间所要发生的时间,循环发生
thisform.timer1.TIMER 事件
问题
if thisform.label1.left< 0-thisform.label1.widththisform.label1.left=thisform.width
这一句是什么意思?
怎么都不说话了!
是不是嫌我太罗嗦了,如果是还望大哥们多担待些。自己测试后的问题
你好我测试了一下这段代码
发现的确实现里你的要求
可是 我去掉-thisform.label1.width
即代码thisform.label1.left< 0 表示该标签如果是距离左边为0
为真 则thisform.label1.left=thisform.width 即返回在最左边
为假 则thisform.label1.left=thisform.label1.left-3 即在原来基础上减去3个单位的距离 这样循环判断
就实现了你要说的结果
呵呵 兄弟 我现在才学vf 希望大哥指导 呵呵 我没学过其他编程的
最近才到这个坛子 呵呵 我的qq 775883015 联系我哦
页:
[1]
