---
title: VB6上課記錄2019.6.30
description: 彰商資處科107學年度程設
image:
tags: vb6教學, dp107, dp1072
robots: noindex, nofollow
GA:
---
VB6上課記錄2019.6月30日
===
# 感想
覺得Timer是裡面最難的部分 :hatched_chick
# 程式碼
'''javascript
Private Sub Image2_Click()
MsgBox "謝謝光臨,下次再來", , "結束"
End
End Sub
Private Sub Image3_Click()
MsgBox "畫面上會隨機跑出圖片" & vbCrLf & "接觸圖片,滑鼠會變十字" & vbCrLf & "60秒內按到一個得一分", , "規則"
End Sub
Private Sub Image4_Click()
Form3.Show
End Sub
'''
'''javascript
Private Sub Image1_Click()
Me.Image5.Picture = Me.Image1.Picture
End Sub
Private Sub Image2_Click()
Me.Image5.Picture = Me.Image2.Picture
End Sub
Private Sub Image3_Click()
Me.Image5.Picture = Me.Image3.Picture
End Sub
Private Sub Image4_Click()
Me.Image5.Picture = Me.Image4.Picture
End Sub
Private Sub Image6_Click()
from1.ScaleWidth = Me.Image6.Width
from1.ScaleHeight = Me.Image6.Height
End Sub
'''
'''javascript
Dim time As Integer
Dim x As Integer
Dim a As Integer
Private Sub Command1_Click()
Command1.Visible = False
Timer3.Enabled = True
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
time = 60
x = 0
Randomize
End Sub
Private Sub Image1_Click(Index As Integer)
x = x + 1
Me.Label2.Caption = x
Image1(a).Visible = False
Me.Timer2 = False
Me.Timer1 = True
End Sub
Private Sub Timer1_Timer()
a = Int(Rnd * 9)
Image1(a).Visible = True
Timer2.Enabled = True
Timer1.Enabled = False
End Sub
Private Sub Timer2_Timer()
Image1(a).Visible = False
Timer1.Enabled = True
Timer2.Enabled = False
End Sub
Private Sub Timer3_Timer()
time = time - 1
Me.Label1.Caption = time
If Me.Label1 = 0 Then
MsgBox "遊戲結束 共打了" & x & "隻", , 結束
Timer3.Enabled = False
Timer1.Enabled = False
Timer2.Enabled = False
Command1.Visible = True
Image1(a).Visible = False
x = 0
Me.Label2.Caption = x
time = 60
Me.Label1.Caption = time
End If
If x >= 10 And x < 15 Then
Me.Timer1.Interval = 800
Me.Timer2.Interval = 800
End If
If x >= 16 And x < 20 Then
Me.Timer1.Interval = 600
Me.Timer2.Interval = 600
End If
End Sub
'''
#影片
https://youtu.be/5og-JVA6Zrg
https://youtu.be/KxLa8zskuaI
https://youtu.be/cmXl7BA4E58
#程式下載處
https://drive.google.com/drive/folders/1TQpYfKa5kEzCCJx97ytgANMd0LxPz3sT?usp=sharing