dark elf游戏图片:急救! vb编程:如何用一个按钮控制红黄绿三个灯进行切换

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/03 03:27:06

灯,你可以用vb中的Shape1控件,添加三个shape控件
将Shape1的shape改成2就成圆的了.然后将backstyle值设为1,将backcolor改成你想要的灯颜色
,然后就写代码就可以了
dim i as integer
按钮1的程序如下:
i=i+1
if i>2 Then i=0
if i=0 then shape1.backstyle=1
if i=1 then shape2.backstyle=1
if i=2 then shape3.backstyle=1

在窗体创建一个按钮
dim i as integer
按钮1的程序如下:
i=i+1
if i>2 Then i=0
if i=0 then text1.text="红"
if i=1 then text1.text="黄"
if i=2 then text1.text="绿"

按钮时
变量不停加1
判断模1,模2, 模3,
模3后变为1

建议给I赋初值