您的位置:程序门 -> vb -> 基础类



关于button的小小小问题!请各位帮忙看一下~~t_t


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


关于button的小小小问题!请各位帮忙看一下~~t_t[无满意答案结贴]
发表于:2008-01-21 20:41:14 楼主
要求设计一个小游戏类似老虎机之类的,3个数字滚动,停止,有3个一样的就得奖之类的……   汗

其中有一条要求
按下button1之后,数字开始滚动,button在三秒钟之内失效
button1.enabled   =   false
3秒之后   数字停止滚动   button又能按了

这个应该怎么编呢…
(有提示用timer)
  private   sub   button1_click(byval   sender   as   system.object,   byval   e   as   system.eventargs)   handles   button1.click
                timer1.enabled   =   true
                button1.enabled   =   false

                currenttime   =   format(timevalue(now),   "")
我只写到这里了…

学vb才一个月,所以想请各位大虾帮忙一下,伸出援手,小女子感激不尽~~~

ps.因为刚入门,学得很浅,所以最好是简单的,谢谢,谢谢,谢谢~~~
发表于:2008-01-21 21:08:351楼 得分:0
到.net区问吧,看你的代码是.net的。
发表于:2008-01-21 22:01:522楼 得分:0
把button.enabled=false写到timer的事件里啊.
把timer的时间间隔设置为1000,
再在timer里用个变量记数器,
timer每执行一次
变量加一,
当变量等于3时,
button.enabled=false
发表于:2008-01-21 22:04:263楼 得分:0
不是button.enabled=false,
是button.enabled=true
发表于:2008-01-22 10:13:374楼 得分:0
不知道是.net区没有人回答还是个个都以为vb.net和vb是同一种语言
发表于:2008-01-22 10:31:355楼 得分:0
vb.net code
option explicit dim xx as integer private sub command1_click() me.timer1.enabled = true command1.enabled = not command1.enabled command1.caption = 3 end sub private sub form_load() timer1.enabled = false end sub private sub timer1_timer() if xx = 3 then timer1.enabled = false command1.enabled = true command1.caption = "ok" xx = 0 else command1.caption = command1.caption - xx xx = xx + 1 end if end sub


快速检索

最新资讯
热门点击