| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 666 人关注过本帖
标题:菜鸟求助数字游戏的问题
取消只看楼主 加入收藏
wsllsg
Rank: 1
来 自:浙江杭州
等 级:新手上路
帖 子:16
专家分:0
注 册:2008-7-23
收藏
 问题点数:0 回复次数:1 
菜鸟求助数字游戏的问题
图片附件: 游客没有浏览图片的权限,请 登录注册
我想让四个数字分别1秒加一次,可是这代码写好后四个数字隔一秒不是+1而是+好多。。。。。
4个intervel属性为1000,求助大虾们怎么改下代码




Dim i As Integer, number As Integer
Private Sub Command1_Click()
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
Timer1.Enabled = True
Timer2.Enabled = True
Timer3.Enabled = True
Timer4.Enabled = True
Command1.Caption = Format(Int(Rnd * 10000), "0000")
Command1.Enabled = False
End Sub

Private Sub Command2_Click()
Timer1.Enabled = False
If Not (Timer1.Enabled Or Timer2.Enabled Or Timer3.Enabled Or Timer4.Enabled) Then
number = Label1.Caption * 1000 + Label2.Caption * 100 + Label3.Caption * 10 + Label4.Caption
If Command1.Caption = number Then
MsgBox "你真强"
End If
Command1.Caption = "开始"
Command1.Enabled = True
End If
End Sub
Private Sub Command3_Click()
Timer2.Enabled = False
If Not (Timer1.Enabled Or Timer2.Enabled Or Timer3.Enabled Or Timer4.Enabled) Then
number = Label1.Caption * 1000 + Label2.Caption * 100 + Label3.Caption * 10 + Label4.Caption
If Command1.Caption = number Then
MsgBox "你真强"
End If
Command1.Caption = "开始"
Command1.Enabled = True
End If
End Sub
Private Sub Command4_Click()
Timer3.Enabled = False
If Not (Timer1.Enabled Or Timer2.Enabled Or Timer3.Enabled Or Timer4.Enabled) Then
number = Label1.Caption * 1000 + Label2.Caption * 100 + Label3.Caption * 10 + Label4.Caption
If Command1.Caption = number Then
MsgBox "你真强"
End If
Command1.Caption = "开始"
Command1.Enabled = True
End If
End Sub

Private Sub Command5_Click()
Timer4.Enabled = False
If Not (Timer1.Enabled Or Timer2.Enabled Or Timer3.Enabled Or Timer4.Enabled) Then
number = Label1.Caption * 1000 + Label2.Caption * 100 + Label3.Caption * 10 + Label4.Caption
If Command1.Caption = number Then
MsgBox "你真强"
End If
Command1.Caption = "开始"
Command1.Enabled = True
End If
End Sub



Private Sub Timer1_Timer()
Label1.Caption = i
If i = 9 Then
i = 0
Else
i = i + 1
End If
End Sub

Private Sub Timer2_Timer()
Label2.Caption = i
If i = 9 Then
i = 0
Else
i = i + 1
End If
End Sub
Private Sub Timer3_Timer()
Label3.Caption = i
If i = 9 Then
i = 0
Else
i = i + 1
End If
End Sub
Private Sub Timer4_Timer()
Label4.Caption = i
If i = 9 Then
i = 0
Else
i = i + 1
End If
End Sub
搜索更多相关主题的帖子: 数字 游戏 
2008-09-05 19:20
wsllsg
Rank: 1
来 自:浙江杭州
等 级:新手上路
帖 子:16
专家分:0
注 册:2008-7-23
收藏
得分:0 
哈哈,问题解决了,谢谢你!原来每个timer的计数器都要自己定义一个,学习到了!!

にㄐ我很乖、С又不ㄇ坏,Ч善ō良┞又可∧τ爱!
2008-09-05 21:24
快速回复:菜鸟求助数字游戏的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.023106 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved