小弟才学VB,遇到关于msgbox的有关问题,求大神指导
小弟才学VB,遇到关于msgbox的问题,求大神指导
Dim t As Single
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Image1.Left = Image1.Left + Rnd * 200
Image2.Left = Image2.Left + Rnd * 200
t = t + 0.1
Text1.Text = t
If Image1.Left >= 9600 Or Image2.Left >= 9600 Then
Timer1.Enabled = False
End If
End Sub
就是让两张图片往右边移动,看谁先到达终点。若1先到达则弹出消息框显示1先到达,若2先到达则弹出对话框显示2先到达。请问这个msg应该怎么写?写到哪里?
------解决思路----------------------
哦, 是从左往右啊.
那么就是:
Image1.Left = Image1.Left + Rnd * 200
if image1.left>= 9600-image1.width then msgbox" Image1 Win!"
Image2.Left = Image2.Left + Rnd * 200
if image2.left>= 9600-image1.width then msgbox"Image2 Win!"
Dim t As Single
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Image1.Left = Image1.Left + Rnd * 200
Image2.Left = Image2.Left + Rnd * 200
t = t + 0.1
Text1.Text = t
If Image1.Left >= 9600 Or Image2.Left >= 9600 Then
Timer1.Enabled = False
End If
End Sub
就是让两张图片往右边移动,看谁先到达终点。若1先到达则弹出消息框显示1先到达,若2先到达则弹出对话框显示2先到达。请问这个msg应该怎么写?写到哪里?
------解决思路----------------------
哦, 是从左往右啊.
那么就是:
Image1.Left = Image1.Left + Rnd * 200
if image1.left>= 9600-image1.width then msgbox" Image1 Win!"
Image2.Left = Image2.Left + Rnd * 200
if image2.left>= 9600-image1.width then msgbox"Image2 Win!"