vb 编写简单连连看
要求:程序能完成概述中的基本功能。要求每一屏至少随机出现20种以上的卡通图案。M与N可由游戏者输入确定。要...
要求:
程序能完成概述中的基本功能。
要求每一屏至少随机出现20种以上的卡通图案。
M与N可由游戏者输入确定。
要求屏幕上显示当前所玩的游戏等级,该机别中卡通总数,剩余卡通数,用户已用时间等。
主界面为窗口界面,包含菜单栏。菜单中至少要有“运行”菜单,含“run”命令、“stop”命令;“帮助”菜单,含“Help” 命令、“About” 命令(Help内容是操作说明。About内容是开发者的姓名、学号、日期等。(见有关要求的说明。)
大致符合就可以 展开
程序能完成概述中的基本功能。
要求每一屏至少随机出现20种以上的卡通图案。
M与N可由游戏者输入确定。
要求屏幕上显示当前所玩的游戏等级,该机别中卡通总数,剩余卡通数,用户已用时间等。
主界面为窗口界面,包含菜单栏。菜单中至少要有“运行”菜单,含“run”命令、“stop”命令;“帮助”菜单,含“Help” 命令、“About” 命令(Help内容是操作说明。About内容是开发者的姓名、学号、日期等。(见有关要求的说明。)
大致符合就可以 展开
2个回答
展开全部
试试吧:
Option Explicit
'添加一个picture1(0),2个时钟控件 滚动条 ,窗体2 (form2为启动窗口)
'请在D:\新建文件夹 文件夹下加载10个图片(名字分别为 1、2、3、4、5.....10)
'虽然做的不好 却是用心去做的 以修改了随即问题!
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
Dim ll As Integer
Dim ww As Integer
Dim a As Integer
Dim mm1, nn1 As Integer
Dim ty, yt As Integer
Dim strnn As String
Dim strmm As String
Private Sub Form_Load()
On Error GoTo Myerror
Me.Visible = False
pp = 0
kk = ".jpg"
ProgressBar1.Max = 200
Picture1(0).Visible = False
For i = 1 To 100
pp = pp + 1
If pp = 11 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).AutoRedraw = True
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 - 150
ProgressBar1.Height = 255
ProgressBar1.Width = Me.Width
ProgressBar1.Top = hh - 800
ProgressBar1.Left = 0
Timer1.Interval = 500
Timer2.Interval = 100
Timer1.Enabled = False
Randomize Timer2
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 = 11 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 = 11 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
Private Sub Timer2_Timer()
a = a + 1
If a = 100 Then
Timer2.Enabled = False
Timer1.Enabled = True
Me.Show
form2.hide
End If
ll = Int(Rnd * 101)
ww = Int(Rnd * 101)
strnn = strnn + "," + Str(ll)
strmm = strmm + "," + Str(ww)
If InStr(ll, strnn) = 0 And InStr(ww, strmm) = 0 Then
If ll <> 0 And ww <> 0 Then
If ll <> ww Then
mm1 = Picture1(ll).Left
nn1 = Picture1(ll).Top
ty = Picture1(ww).Left
yt = Picture1(ww).Top
Picture1(ll).Left = ty
Picture1(ll).Top = yt
Picture1(ww).Top = nn1
Picture1(ww).Left = mm1
End If
End If
End If
End Sub
Option Explicit
'添加一个picture1(0),2个时钟控件 滚动条 ,窗体2 (form2为启动窗口)
'请在D:\新建文件夹 文件夹下加载10个图片(名字分别为 1、2、3、4、5.....10)
'虽然做的不好 却是用心去做的 以修改了随即问题!
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
Dim ll As Integer
Dim ww As Integer
Dim a As Integer
Dim mm1, nn1 As Integer
Dim ty, yt As Integer
Dim strnn As String
Dim strmm As String
Private Sub Form_Load()
On Error GoTo Myerror
Me.Visible = False
pp = 0
kk = ".jpg"
ProgressBar1.Max = 200
Picture1(0).Visible = False
For i = 1 To 100
pp = pp + 1
If pp = 11 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).AutoRedraw = True
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 - 150
ProgressBar1.Height = 255
ProgressBar1.Width = Me.Width
ProgressBar1.Top = hh - 800
ProgressBar1.Left = 0
Timer1.Interval = 500
Timer2.Interval = 100
Timer1.Enabled = False
Randomize Timer2
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 = 11 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 = 11 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
Private Sub Timer2_Timer()
a = a + 1
If a = 100 Then
Timer2.Enabled = False
Timer1.Enabled = True
Me.Show
form2.hide
End If
ll = Int(Rnd * 101)
ww = Int(Rnd * 101)
strnn = strnn + "," + Str(ll)
strmm = strmm + "," + Str(ww)
If InStr(ll, strnn) = 0 And InStr(ww, strmm) = 0 Then
If ll <> 0 And ww <> 0 Then
If ll <> ww Then
mm1 = Picture1(ll).Left
nn1 = Picture1(ll).Top
ty = Picture1(ww).Left
yt = Picture1(ww).Top
Picture1(ll).Left = ty
Picture1(ll).Top = yt
Picture1(ww).Top = nn1
Picture1(ww).Left = mm1
End If
End If
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询