|
|
这个是设计原理,可以设计更复杂的连连看。
Option Explicit
'添加一个picture1(0),一个时钟控件 一个 滚动条
'图片随即还没想出来 如果你想出来了好办法 请贴出来吧!
'请在D:\新建文件夹 文件夹下加载5个图片(名字分别为 1、2、3、4、5)
'虽然做的不好 却是用心去做的
Dim i As Integer '要建立的图片框个数
Dim aa As Integer
Dim gg As Integer
Dim ss As Integer
Dim jj As Integer, hh As Integer '保存声明窗体的宽度和长度
Dim tt As Integer '声明时间变量
Dim ff As Integer
Dim nn As Integer '声明图片框已经隐藏的变量
Dim kk As String
Dim pp As Integer
Dim j, uu As Integer
Dim tf As Integer, kl As Integer
Dim oo As Integer
Dim vv As Integer
Dim rr, mm As Integer
Dim cc As Integer
Dim ee, qq As Integer
Private Sub Form_Load()
On Error GoTo Myerror
pp = 0
kk = ".jpg"
ProgressBar1.Max = 200
Picture1(0).Visible = False
For i = 1 To 100
pp = pp + 1
If pp = 6 Then
pp = 1
End If
gg = gg + 1
If gg = 10 Then
ss = ss + Picture1(0).Height + 50
gg = 0
aa = Picture1(0).Left
hh = ss + 800
Else
aa = aa + Picture1(0).Width + 50
jj = aa + Picture1(0).Width + 120
End If
Load Picture1(i)
Picture1(i).Picture = LoadPicture("d:\新建文件夹\" & pp & kk)
Picture1(i).Width = Picture1(0).Width
Picture1(i).Height = Picture1(0).Height
Picture1(i).Left = aa
Picture1(i).Top = ss
Picture1(i).Visible = True
If i = 100 Then
Picture1(100).Left = Picture1(0).Left
Picture1(100).Top = Picture1(0).Top
Picture1(100).Height = Picture1(0).Height
Picture1(100).Width = Picture1(0).Width
Picture1(100).Visible = True
Picture1(100).Picture = LoadPicture("d:\新建文件夹\" & pp & kk)
End If
Next i
Me.Width = jj
Me.Height = hh
ProgressBar1.Height = 255
ProgressBar1.Width = me.width
ProgressBar1.Top = hh - 800
ProgressBar1.Left = 0
Timer1.Interval = 500
tt = 200
ProgressBar1.Value = tt
Exit Sub
Myerror:
MsgBox "D:\新建文件夹 文件夹下加载图片", vbOKOnly, "错误对话框“"
End
End Sub
Private Sub Picture1_Click(Index As Integer)
nn = 0
pp = 0
Select Case Index
Case Index
oo = oo + 1
If oo = 1 Then
ee = Index
For vv = 1 To 100
pp = pp + 1
If pp = 6 Then
pp = 1
End If
If vv = Index Then
rr = vv
tf = pp
End If
Next
End If
If oo = 2 Then
qq = Index
For vv = 1 To 100
pp = pp + 1
If pp = 6 Then
pp = 1
End If
If vv = Index Then
mm = vv
kl = pp
End If
Next vv
oo = 0
End If
If tf = kl Then
If ee <> qq Then
Picture1(rr).Visible = False
Picture1(mm).Visible = False
tf = 0
kl = 0
End If
End If
End Select
For i = 0 To 99
If Picture1(i).Visible = False Then
nn = nn + 1
End If
If nn = 100 Then
MsgBox "恭喜!!! 过关了!"
Timer1.Enabled = False
End If
Next i
End Sub
Private Sub Timer1_Timer()
tt = tt - 1
ProgressBar1.Value = tt
If tt = 0 Then
ff = MsgBox("哈哈 您已经输了", vbOKOnly, "关闭对话框")
If ff = 1 Then
End
End If
End If
End Sub |
|