vfp6.0怎么在表单里添加东西命令按钮,标签,文本框

vfp6.0怎么在表单里添加东西命令按钮,标签,文本框,第1张

新建或打开表单后,VFP会自动打开“表单控件”"属性"等,如果没有自动打开,

则点菜单--“显示”——"表单控件工具栏“,单击“表单控件”中的相关控件,

然后将鼠标移动到表单上,点击一下就可以了。

1、先在表单的init事件中加上:

public a,b

a=5

b=5

2、然后添加一个标签(label)控件到表单中,caption值改为"你好"

3、再添加一个时钟(timer)控件到表单中,将其interval属性改为200(刷新时间,单位毫秒,1000表示1秒),最后在timer事件中加上代码:

thisform.label1.left=thisform.label1.left+a

thisform.label1.top=thisform.label1.top+b

if thisform.label1.left<0 or thisform.label1.left+thisform.label1.width>thisform.width

a=-a

endif

if thisform.label1.top<0 or thisform.label1.top+thisform.label1.height>thisform.height

b=-b

endif

在表单上添加1个容器控件Container1

右键点击Container1,在d出的菜单中选“编辑”

在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.


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/bake/11840847.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-19
下一篇2023-05-19

发表评论

登录后才能评论

评论列表(0条)

    保存