| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 664 人关注过本帖
标题:上课用的,哪位大侠愿意帮忙,求教备注下汉语意思啊
只看楼主 加入收藏
Wimong
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2013-5-17
结帖率:0
收藏
已结贴  问题点数:10 回复次数:7 
上课用的,哪位大侠愿意帮忙,求教备注下汉语意思啊
打字母游戏中的代码(忘了哪里下载的了)

开始:Command2    暂停:Command1   重玩:Command3
lable是字母

Private Sub Command2_Click()
Timer1.Enabled = True
End Sub

Private Sub Command3_Click()   
Picture1.Item(0).Top = -1000
Picture1.Item(2).Top = -800
Picture1.Item(3).Top = -700
Picture1.Item(4).Top = -800
Picture1.Item(1).Top = -600
Timer1.Enabled = False
Dim a(5) As Integer
Randomize
a(1) = Int(65 + 25 * Rnd)
Label1.Item(0).Caption = Chr(a(1))
k = 1
Do While k < 5
m = Int(Rnd * 25 + 65)
f = 0
For j = 1 To k
   If m = a(j) Then
   f = 1
   Exit For
   End If
Next j
If f = 0 Then
   k = k + 1
   a(k) = m
   Label1.Item(k - 1).Caption = Chr(m)
   End If
   Loop
   p = 0
End Sub
搜索更多相关主题的帖子: 字母 游戏 汉语意思 
2015-10-10 22:09
Wimong
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2013-5-17
收藏
得分:0 
Private Sub Form_Load()
sum = 100
num = 10
Dim a(5) As Integer
Randomize
a(1) = Int(65 + 25 * Rnd)
Label1.Item(0).Caption = Chr(a(1))
k = 1
Do While k < 5
m = Int(Rnd * 25 + 65)
f = 0
For j = 1 To k
   If m = a(j) Then
   f = 1
   Exit For
   End If
Next j
If f = 0 Then
   k = k + 1
   a(k) = m
   Label1.Item(k - 1).Caption = Chr(m)
   End If
   Loop
End Sub
2015-10-10 22:13
yangfrancis
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:贵宾
威 望:141
帖 子:1510
专家分:7661
注 册:2014-5-19
收藏
得分:5 
这个忙不好帮了。看旁人写的代码实在比自己写一个打字游戏还困难。
2015-10-11 14:13
风吹过b
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:364
帖 子:4947
专家分:30084
注 册:2008-10-15
收藏
得分:5 
Private Sub Command2_Click()
Timer1.Enabled = True                            '定时器开
End Sub

Private Sub Command3_Click()   
Picture1.Item(0).Top = -1000                     '5个控件的顶坐标
Picture1.Item(2).Top = -800
Picture1.Item(3).Top = -700
Picture1.Item(4).Top = -800
Picture1.Item(1).Top = -600
Timer1.Enabled = False                      '定时器初始关
Dim a(5) As Integer
Randomize                                   '初始化随机数发生器
a(1) = Int(65 + 25 * Rnd)                   '产生第一个字母的ASCII码
Label1.Item(0).Caption = Chr(a(1))          '显示
k = 1                                   
Do While k < 5                              'do 循环开始
m = Int(Rnd * 25 + 65)                      '产生一个字母的ASCII码
f = 0                        
For j = 1 To k                   '搜索已产生的字母
   If m = a(j) Then              '如果有相同的
   f = 1                         '标志
   Exit For
   End If
Next j
If f = 0 Then                    '如果没找到相同的
   k = k + 1                     '计数器向后走
   a(k) = m                      '保存结果
   Label1.Item(k - 1).Caption = Chr(m)      '显示
   End If
   Loop                         'do 循环结束
   p = 0                 
End Sub

授人于鱼,不如授人于渔
早已停用QQ了
2015-10-11 15:58
Wimong
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2013-5-17
收藏
得分:0 
谢谢啊
2015-10-11 23:13
Wimong
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2013-5-17
收藏
得分:0 
谢谢
2015-10-11 23:18
Wimong
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2013-5-17
收藏
得分:0 
哪位大侠把红色部分帮助注释一下啊。
Public h As Integer
Public s As Integer
Public p As Integer
Public sum As Integer, num As Integer
Private Sub Command1_Click()
Timer1.Enabled = False

End Sub

Private Sub Command2_Click()
Timer1.Enabled = True
End Sub
----------------------以下键盘输入
Private Sub Form_KeyPress(KeyAscii As Integer)
For i = 0 To 4                                  ‘当i从0到4依次取值
If Label1.Item(i).Caption = Chr(KeyAscii - 32) Then  '如果输入字母与标签中字母相同
s = s + 1                                              ‘?
If s = sum Then Form3.Show: Form3.Label1.Caption = "恭喜你顺利过关!再接再厉吧!": Timer1.Enabled = False

Label1.Item(i).Caption = letter(i)                  ’?
Picture1.Item(i).Top = -600                        '字母消失?
    k = 1
Do While k <> 0
     k = 0
    n = Chr(Int(25 * Rnd + 65))
For j = 0 To 4
   If n = Label1.Item(j).Caption Then k = k + 1
   Next j
   If k = 0 Then Label1.Item(i).Caption = n
    Loop

   End If
Next i
End Sub

-------------------以下是游戏开始
Private Sub Form_Load()
sum = 100
num = 10
Dim a(5) As Integer      定义5个数组
Randomize
a(1) = Int(65 + 25 * Rnd)   ‘随机取字母
Label1.Item(0).Caption = Chr(a(1))  '?
k = 1                                  '?
Do While k < 5
m = Int(Rnd * 25 + 65)
f = 0
For j = 1 To k
   If m = a(j) Then
   f = 1
   Exit For
   End If
Next j
If f = 0 Then
   k = k + 1
   a(k) = m
   Label1.Item(k - 1).Caption = Chr(m)
   End If
   Loop
End Sub
2015-10-11 23:25
风吹过b
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:364
帖 子:4947
专家分:30084
注 册:2008-10-15
收藏
得分:0 
s = s + 1                                              '计分,消除个数
If s = sum Then Form3.Show: Form3.Label1.Caption = "恭喜你顺利过关!再接再厉吧!": Timer1.Enabled = False            '是否消除到指定个数,如果是,提示过关,关定时器

Label1.Item(i).Caption = letter(i)                  ’显示字母,可以简写成 Label1(i).Caption = letter(i)
Picture1.Item(i).Top = -600                        '显示控件放到窗体之外,也就是消失

a(1) = Int(65 + 25 * Rnd)   ‘随机取字母
Label1.Item(0).Caption = Chr(a(1))  '显示字母
k = 1                                  '循环变量,使用DO循环

授人于鱼,不如授人于渔
早已停用QQ了
2015-10-12 14:38
快速回复:上课用的,哪位大侠愿意帮忙,求教备注下汉语意思啊
数据加载中...
 
   



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

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