想让字母从屏幕上住下落,可以通过什么方法啊?
再帮忙看看下面的代码,有什么问题啊?谢谢!!
Option Explicit Dim score As Integer '定义得分 Dim c As String '定义提示 Dim speed As Integer '定义速度
Sub init() '字符的初始化 Label1.Caption = Chr(Int(Rnd * 26) + 97) speed = Int(Rnd * 10 + 100) Label1.Left = Int(Rnd * Form1.Width) '字符出现的位置 Label1.Top = 0 End Sub
Private Sub Command1_Click() Timer1.Enabled = True Timer2.Enabled = True
If Label4.Caption = "测试时间" Then Label4.Caption = "剩余时间" End If If Command1.Caption = "开始" Then Command1.Caption = "暂停" End If Text1.Text = 0 Print Label1.Caption End Sub
Private Sub Command2_Click() End End Sub
Private Sub Form_KeyPress(KeyAscii As Integer) If Chr(KeyAscii) = Label1.Caption Then '判断所按键位是否与产生的字符相符 init
score = score + 1 Text1.Text = score End If End Sub
Private Sub Form_Load() Randomize Text1.Text = "" Text2.Text = "200" Combo1.AddItem 2 Combo1.AddItem 3 c = "时间到" End Sub
Private Sub Timer1_Timer() Label1.Top = Label1.Top + speed If Label1.Top > Form1.Height Then init End If End Sub
Private Sub Timer2_Timer() Text2.Text = Val(Text2.Text) - 1 If Val(Text2.Text) <= 0 Then '判断时间是否用完 Timer1.Enabled = False Label1.Caption = "" Select Case score Case Is <= 100 MsgBox c + vbCrLf + "别灰心,再加把劲!" Case Is < 250 MsgBox c + vbCrLf + "不错,请继续努力。" Case Is >= 250 MsgBox c + vbCrLf + "你真棒!恭喜你已成为高手。" End Select Timer2.Enabled = False End If End Sub