当前位置:编程学习 > VB >>

vb实习儿童识字问题,请解释一下代码,尽量详细,谢谢

Dim a As String, b(9) As Integer, c As String, i As Integer, d(9) As Integer, e(9) As Integer, m As Integer, n As Integer Private Sub Command1_Click() Command2.Caption = "上一页" Form1.Cls For i = 0 To 9 lp: Randomize b(i) = Int(Rnd * 10) + 1 For j = 0 To i - 1 If b(i) = b(j) Then GoTo lp Next j a = App.Path & "\" & b(i) & ".jpg" c = App.Path & "\" & b(i) & ".bmp" Picture1(i).Picture = LoadPicture(a) Picture2(i).Picture = LoadPicture(c) Next i For i = 0 To 4 lq: Randomize b(i) = Int(Rnd * 5) + 1 For j = 0 To i - 1 If b(i) = b(j) Then GoTo lq Next j Picture2(i).Left = 1800 * b(i) - 1200 Picture2(i + 5).Left = 1800 * b(i) - 1200 Next i End Sub Private Sub Command2_Click() Form1.Cls Static Index As Integer Index = Index + 1 If Index = 1 Then For i = 0 To 4 Picture1(i).Visible = False Picture1(i + 5).Visible = True Picture2(i).Visible = False Picture2(i + 5).Visible = True Next i Command2.Caption = "下一页" ElseIf Index = 2 Then Call Command1_Click Index = 0 End If End Sub Private Sub Picture1_Click(Index As Integer) Picture1(Index).Picture = LoadPicture m = Index Picture1(Index).Picture = LoadPicture(App.Path & "\" & b(m) & ".jpg") End Sub Private Sub Picture2_Click(Index As Integer) Picture2(Index).Picture = LoadPicture n = Index Picture2(Index).Picture = LoadPicture(App.Path & "\" & b(m) & ".bmp") If m = n Then Line (Picture1(m).Left + 900, 1695)-(Picture2(n).Left + 900, Picture2(n).Top) MsgBox "好棒啊,祝贺你答对了!", vbOKOnly + vbInformation, "儿童认字" Else MsgBox "对不起,答错了,请再来一次。", vbOKOnly + vbInformation, "儿童认字" End If End Sub
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,