📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
AutoRedraw = -1 'True
Caption = "Form1"
ClientHeight = 7425
ClientLeft = 60
ClientTop = 345
ClientWidth = 8280
LinkTopic = "Form1"
ScaleHeight = 7425
ScaleWidth = 8280
StartUpPosition = 3 'Windows Default
WindowState = 2 'Maximized
Begin VB.Timer Timer2
Enabled = 0 'False
Interval = 1
Left = 810
Top = 1485
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 10
Left = 90
Top = 1530
End
Begin VB.Image Image6
Height = 675
Left = 135
Picture = "Form1.frx":0000
Top = 2025
Visible = 0 'False
Width = 675
End
Begin VB.Image Image5
Height = 375
Left = 45
Picture = "Form1.frx":182A
Top = 1035
Visible = 0 'False
Width = 1350
End
Begin VB.Image Image4
Height = 375
Left = 45
Picture = "Form1.frx":32FC
Stretch = -1 'True
Top = 540
Visible = 0 'False
Width = 1350
End
Begin VB.Image Image3
Height = 375
Left = 45
Picture = "Form1.frx":4DCE
Top = 45
Visible = 0 'False
Width = 1350
End
Begin VB.Image Image2
Height = 495
Left = 5895
Picture = "Form1.frx":68A0
Stretch = -1 'True
Top = 6525
Width = 495
End
Begin VB.Image Image1
Height = 375
Left = 5535
Picture = "Form1.frx":20E72
Top = 7020
Width = 1350
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim xx1 As Byte
Dim yp As Integer
Dim xp As Integer
Dim aa(50, 50) As Integer
Dim xt As Integer
Dim yt As Integer
Dim bb(10, 10) As Integer
Dim bb11(10, 10) As Integer
Dim rig As Integer
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 70 Then
For i = 0 To 10
For u = 0 To 2
aa(i, u) = 0
bb(i, u) = 0
bb11(i, u) = 0
Next u
Next i
Image1.Left = Form1.ScaleWidth / 2 - Image1.Width / 2
Image2.Left = Image1.Left + Image2.Width
Image2.Top = Image1.Top - Image2.Height
Show
Print
For i = 0 To 3
10
a = Int(Rnd(0.5) * 9)
b = Int(Rnd(0.5) * 3)
bb11(a, b) = 1
If bb11(a, b) = bb(a, b) Then GoTo 10
bb(a, b) = 1
Next i
For i = 0 To 8
For u = 0 To 2
Form1.PaintPicture Image3.Picture, i * Image3.Width, u * Image3.Height
Next u
Next i
xt = 150
yt = 150
End If
If xx1 = 0 Then
If KeyCode = 40 Then
Image2.Left = Image1.Left + Image2.Width
Image2.Top = Image1.Top - Image2.Height
Timer1.Enabled = True
xx1 = 1
yp = 150
xp = -150
End If
If KeyCode = 38 Then
Image2.Left = Image1.Left + Image2.Width
Image2.Top = Image1.Top - Image2.Height
Timer1.Enabled = True
xx1 = 1
yp = 150
xp = 150
End If
End If
If Image1.Left > 0 Then
If KeyCode = 37 Then
Image1.Left = Image1.Left - xt
If xx1 = 0 Then
Image2.Left = Image1.Left + Image2.Width
End If
End If
End If
If Image1.Left < Form1.ScaleWidth - Image1.Width Then
If KeyCode = 39 Then
Image1.Left = Image1.Left + yt
If xx1 = 0 Then
Image2.Left = Image1.Left + Image2.Width
End If
End If
End If
End Sub
Private Sub Form_Load()
For i = 0 To 8
For u = 0 To 2
bb11(i, u) = 0
bb(i, u) = 0
aa(i, u) = 0
Next u
Next i
Image1.Left = Form1.ScaleWidth / 2 - Image1.Width / 2
Image2.Left = Image1.Left + Image2.Width
Show
Timer1.Enabled = False
Image2.Top = Image1.Top - Image2.Height
Print
xx1 = 0
rig = 0
For i = 0 To 3
10
a = Int(Rnd(0.5) * 9)
b = Int(Rnd(0.5) * 3)
bb11(a, b) = 1
If bb11(a, b) = bb(a, b) Then GoTo 10
bb(a, b) = 1
Next i
For i = 0 To 8
For u = 0 To 2
Form1.PaintPicture Image3.Picture, i * Image3.Width, u * Image3.Height
Next u
Next i
xt = 150
yt = 150
End Sub
Private Sub Timer1_Timer()
Image2.Top = Image2.Top - yp
Image2.Left = Image2.Left - xp
For i = 0 To 8
For u = 0 To 2
If Image2.Top < (u + 1) * Image3.Height And _
Image2.Top > u * Image3.Height Then
If Image2.Left > (i + 1) * Image3.Width - 200 And _
Image2.Left < (i + 1) * Image3.Width + 200 Then
wx i, u
End If
End If
If Image2.Left < (i + 1) * Image3.Width And _
Image2.Left > i * Image3.Width Then
If Image2.Top < u * Image3.Height + Image2.Height And _
Image2.Top > u * Image3.Height Then
wy i, u
End If
End If
If Image2.Top < (u + 1) * Image3.Height And _
Image2.Top > u * Image2.Height Then
If Image2.Left < i * Image3.Width And _
Image2.Left > i * Image3.Width - Image2.Width Then
wx i, u
End If
End If
Next u
Next i
If Image2.Left > Image1.Left - Image2.Width And _
Image2.Left < Image1.Left + Image1.Width Then
If Image2.Top > Image1.Top - Image2.Height And _
Image2.Top < Image1.Top - Image2.Height + 200 Then
yp = -yp
End If
End If
If Image2.Left < 0 Then
Image2.Left = 0
xp = -xp
End If
If Image2.Left > Form1.ScaleWidth - Image2.Width Then
Image2.Left = Form1.ScaleWidth - Image2.Width
xp = -xp
End If
If Image2.Top < 0 Then
Image2.Top = 0
yp = -yp
End If
If Image2.Top > Form1.ScaleHeight Then
xx1 = 0
End If
End Sub
Sub wx(i, u)
If aa(i, u) < 2 Then
xp = -xp
aa(i, u) = aa(i, u) + 1
Form1.PaintPicture Image5.Picture, i * Image3.Width, u * Image3.Height
If aa(i, u) = 2 Then
rig = rig + 1
Form1.PaintPicture Image4.Picture, i * Image3.Width, u * Image3.Height
If bb(i, u) = 1 Then
Timer2.Enabled = True
Image6.Left = i * Image3.Width
Image6.Top = u * Image3.Height
End If
End If
If rig >= 27 Then
a = MsgBox("您还要继续吗?", vbYesNo, "您赢了")
If a = vbNo Then
End
Else
Form_Load
Exit Sub
End If
End If
End If
End Sub
Sub wy(i, u)
If aa(i, u) < 2 Then
yp = -yp
aa(i, u) = aa(i, u) + 1
Form1.PaintPicture Image5.Picture, i * Image3.Width, u * Image3.Height
If aa(i, u) = 2 Then
rig = rig + 1
Form1.PaintPicture Image4.Picture, i * Image3.Width, u * Image3.Height
If bb(i, u) = 1 Then
Timer2.Enabled = True
Image6.Left = i * Image3.Width
Image6.Top = u * Image3.Height
End If
End If
If rig >= 27 Then
a = MsgBox("您还要继续吗?", vbYesNo, "您赢了")
If a = vbNo Then
End
Else
Form_Load
Exit Sub
End If
End If
End If
End Sub
Private Sub Timer2_Timer()
Image6.Visible = True
Image6.Top = Image6.Top + 100
If Image6.Left > Image1.Left - Image6.Width And _
Image6.Left < Image1.Left + Image1.Width Then
If Image6.Top > Image1.Top - Image6.Height And _
Image6.Top < Image1.Top Then
Image6.Visible = False
Timer2.Enabled = False
xt = xt + 500
yt = yt + 500
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -