扫雷-程序设计报告

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Visual Basic课程设计报告
名称:扫雷难度:四星
设计人:田林
指导老师:张小兵
班级:
学号:
时间:2012.3
南京理工大学能源与动力工程学院
知识点:(1)控件数组;(2)绘图;(3)菜单;(4)文本文件的读写;(5)多
模块设计;(6)资源文件的使用。

一、功能简介:
(1)启动程序后,进入初始界面(form1),游戏共有3种预定义的难度级别,为初级(9行9列10个雷),中级(16行16列40个雷),高级(16
行30列99个雷),还有“自定义”命令,可以自行定义雷区行数,
列数和雷数;
(2)雷区上面的小脸可以变化,显示微笑,惊讶,痛苦,胜利。

在任何情况下单击小脸可以重新开始游戏;
(3)鼠标左击排雷,右击插小旗,打问号;
(4)方格里面的数字表示方格周围的雷数;
(5)扫雷成功时候,调用文件看有没有打破该级别的记录。

二、课程设计的详细设计
(1).绘制方格,使用如下程序:
Dim picf As New StdPicture 'picf保存图片对象
form1.pic2.ScaleMode = 3 '以像素为单位
form1.pic2.Cls '图片框清空
Set picf = LoadPicture(App.Path & "1.bmp")
For i = 0 To m - 1
For j = 0 To n - 1
form1.pic2.PaintPicture picf, j * 16, i * 16 '加载图片
Next
Next
(2).放雷的方法:定义一个二维数组aarMine,行数为inthang,列数为intlie,雷的个数intlei,使用下面的程序来解决:
Randomize
ReDim arrMine(inthang, intlie)
Do While int3 < intlei '雷数的随机分布
col = Int(Rnd * intlie)
ln = Int(Rnd * inthang)
If arrMine(ln, col) = False Then
arrMine(ln, col) = True
int3 = int3 + 1
End If
Loop
(3).使用三个pictureclip控件来管理图片:
form1.PictureClip1.Picture = LoadPicture(App.Path & "face.bmp")
form1.PictureClip1.Rows = 1
form1.PictureClip1.Cols = 5
form1.PictureClip2.Picture = LoadPicture(App.Path & "number.bmp")
form1.PictureClip2.Rows = 1
form1.PictureClip2.Cols = 12
form1.PictureClip3.Picture = LoadPicture(App.Path & "mine.bmp")
form1.PictureClip3.Rows = 1
form1.PictureClip3.Cols = 15
(4).使用递归过程(fangkai)来开启方格:
Private Sub fankai(ByVal int1 As Integer, ByVal int2 As Integer) Dim hang As Integer
Dim lie As Integer
Top:
If int1 - 1 = 0 Then GoTo Below
If Sign(int1 - 1, int2) = False Then
Sign(int1 - 1, int2) = True
hang = int1 - 1
lie = int2
GoTo Ddd
End If
Below:
If int1 = inthang Then GoTo Left
If Sign(int1 + 1, int2) = False Then
Sign(int1 + 1, int2) = True
hang = int1 + 1
lie = int2
GoTo Ddd
End If
Left:
If int2 - 1 = 0 Then GoTo Right
If Sign(int1, int2 - 1) = False Then
Sign(int1, int2 - 1) = True
lie = int2 - 1
hang = int1
GoTo Ddd
End If
Right:
If int2 = intlie Then GoTo Righttop
If Sign(int1, int2 + 1) = False Then
Sign(int1, int2 + 1) = True
lie = int2 + 1
hang = int1
GoTo Ddd
End If
Righttop:
If int2 = intlie Or int1 - 1 = 0 Then GoTo Lefttop
If Sign(int1 - 1, int2 + 1) = False Then
Sign(int1 - 1, int2 + 1) = True
lie = int2 + 1
hang = int1 - 1
GoTo Ddd
End If
Lefttop:
If int2 = 1 Or int1 - 1 = 0 Then GoTo Leftbelow
If Sign(int1 - 1, int2 - 1) = False Then
Sign(int1 - 1, int2 - 1) = True
lie = int2 - 1
hang = int1 - 1
GoTo Ddd
End If
Leftbelow:
If int2 = 1 Or int1 = inthang Then GoTo Rightbelow
If Sign(int1 + 1, int2 - 1) = False Then
Sign(int1 + 1, int2 - 1) = True
lie = int2 - 1
hang = int1 + 1
GoTo Ddd
End If
Rightbelow:
If int2 = intlie Or int1 = inthang Then Exit Sub
If Sign(int1 + 1, int2 + 1) = False Then
Sign(int1 + 1, int2 + 1) = True
lie = int2 + 1
hang = int1 + 1
GoTo Ddd
Else
Exit Sub
End If
Ddd:
If leishu(hang, lie) <> 0 Then
pic2.PaintPicture PictureClip3.GraphicCell(15 - leishu(hang, lie)), (lie - 1) * 16, (hang - 1) * 16
GoTo Top
Else
pic2.PaintPicture PictureClip3.GraphicCell(15), (lie - 1) * 16, (hang - 1) * 16
Call fankai(hang, lie)
GoTo Top
End If
(5).“扫雷英雄榜”分3个文件夹保存(chuji,zhongji,gaoji )
If inthang = 9 And intlie = 9 Then
Open App.Path & "\chuji.txt" For Input As 1
Line Input #1, str1(0)
str2(0) = CInt(Left(str1(0), InStr(str1(0), " ")))
If intNum < CInt(str2(0)) Then
InputBox " 恭喜你破了本难度的记录!请留下大名", , "无名侠"
End If
Close 1
ElseIf intlie = 16 And inthang = 9 Then
Open App.Path & "\zhongji.txt" For Input As 1
Line Input #1, str1(1)
str2(1) = CInt(Left(str1(1), InStr(str1(1), " ")))
If intNum < CInt(str2(1)) Then
InputBox " 恭喜你破了本难度的记录!请留下大名", , "无名侠"
End If
Close 1
ElseIf intlie = 30 And inthang = 16 Then
Open App.Path & "\gaoji.txt" For Input As 1
Line Input #1, str1(2)
str2(2) = CInt(Left(str1(2), InStr(str1(2), " ")))
If intNum < CInt(str2(2)) Then
InputBox " 恭喜你破了本难度的记录!请留下大名", , "无名侠"
End If
Close 1
End If
(7).通过数组a()来确定插小旗,同时右上角的雷数随之改变:先在Module1中定义数组Sign()和a():
ReDim Sign(1 To inthang, 1 To intlie)
ReDim a(0 To inthang - 1, 0 To intlie - 1)
然后在form1写如以下程序:
If Sign(int1 + 1, int2 + 1) = False Then
a(int1, int2) = a(int1, int2) + 1
If a(int1, int2) Mod 3 = 1 Then
pic2.PaintPicture PictureClip3.GraphicCell(1), int2 * 16, int1 * 16
k = k - 1
End If
If a(int1, int2) Mod 3 = 2 Then
pic2.PaintPicture PictureClip3.GraphicCell(2), int2 * 16, int1 * 16
k = k + 1
End If
If a(int1, int2) Mod 3 = 0 Then
pic2.PaintPicture PictureClip3.GraphicCell(0), int2 * 16, int1
* 16
End If
If k >= 0 Then
imglei(0).Picture = form1.PictureClip2.GraphicCell(11 - k \ 100)
imglei(1).Picture = form1.PictureClip2.GraphicCell(11 - k \
10 Mod 10)
imglei(2).Picture = form1.PictureClip2.GraphicCell(11 - k Mod 10)
Else
imglei(0).Picture = form1.PictureClip2.GraphicCell(0)
imglei(1).Picture = form1.PictureClip2.GraphicCell(11 + k \
10 Mod 10)
imglei(2).Picture = form1.PictureClip2.GraphicCell(11 + k Mod 10)
End If
End If
三、调试程序的过程
(1)在写程序时,刚开始自己没有想到要用标准模块来定义全局变量和过程,这样虽然也能实现功能,但增加了调试程序的
难度,最后,自己试着运用标准模块来定义,果然收到不同
的效果;
(2)在显示LED风格的数字时,自己想过要用LoadResPicture 函数加载图片并使用PaintPicture方法绘制,而且书上也介
绍了相应代码,但自己还是感觉使用PictureClip控件更方
便,更容易理解,于是自己便选择了运用后者;
(3)在记录游戏成绩时文件打不开,提示信息说是类型不匹配和路径错误,自己调试了好久,现把前后的代码记录如下:
错误的代码:
If inthang = 9 and intlie=9 Then
Open "F:\chuji.txt" For Input As 1
Line Input #1, str1(0)
str2(0) = Left(str1(0), " ")
If intNum < CInt(str2(0)) Then
InputBox " 恭喜你破了本难度的记录!请留下大名", , "无名侠"
End If
Close 1
ElseIf intlie = 16 and inthang=16Then
Open "F:\zhongji.txt" For Input As 1
Line Input #1, str1(1)
str2(1) = Left(str1(1), " ")
If intNum < CInt(str2(1)) Then
InputBox " 恭喜你破了本难度的记录!请留下大名", , "无名侠"
End If
Close 1
ElseIf intlie = 30 and inthang =16 Then
Open "F:\gaojiji.txt" For Input As 1
Line Input #1, str1(2)
str2(2) = Left(str1(2), " ")
If intNum < CInt(str2(2)) Then
InputBox " 恭喜你破了本难度的记录!请留下大名", , "无名侠"
End If
Close 1
End If
End If
改过的代码:如上述课程设计的详细设计中的(5)的代码。

四、课程设计心得
通过该程序,让我充分体会到了理论与实践相结合的重要性.VB课程设计,它不比期末考试与二级考试,它更看重的是应用技巧。

而其,其中有好多的算法和技巧要求了解和掌握,不去问同学或老师,仅凭一己之力,是很难预期完成的。

在编程时的收获不少,除了对编程语言有了更深一步的了解,还有同学之间的友谊加深。

在自己有了困难时,同学或老师的大力帮助,自己真的很感动。

再一次谢谢我的同学和老师。

当然在编程时还有许多经验和教训值得反思,现在自己整理一下:
(1)在开始编程之前,要先构思各种功能实现的算法,想好了以后在上机编写,不要急于上机;
(2)编程时一定要注意变量的使用,切勿胡乱使用变量。

我在编程时候最大
的问题就是变量总是搞错,那就要反复调试,最后才搞清楚变量的含义;(3)编程不要过于复杂,多调用过程;
(4)编程过程中,由于自己对理论知识的欠缺,很多方面都很模糊。

自己不得不花大量时间去查阅资料并且整理出来,这充分证明了自己对VB的了解甚少,需要在以后的学习中来完善。

(5)编程结束,自己再多运行,调试几次可能有某个方面自己没注意到,当中得到了很多同学的帮助,我再一次谢谢他们。

五、附件
主要的源代码:
Module1:
Option Explicit
Public inthang As Integer
Public intlie As Integer
Public intlei As Integer
Public i As Integer, j As Integer, k As Integer, h As Integer
Public intNum As Integer
Public arrMine() As Boolean, col As Integer, ln As Integer
Public int1 As Integer, int2 As Integer
Public Sign() As Boolean
Public a() As Integer
Public Sub sub1(m As Integer, n As Integer, l As Integer) 'm表示行数,n表示列数,l 表示雷数
Dim int3 As Integer
form1.pic2.Width = 245 * n '245是一个小图片的宽度
form1.pic1.Width = 245 * n
form1.pic2.Height = 245 * m
form1.Width = 340 + form1.pic2.Width
form1.Height = 1760 + form1.pic2.Height
form1.image1.Left = form1.pic1.Width / 2 - 375 / 2 '375是image1的Width 属性值
Dim picf As New StdPicture 'picf保存图片对象
form1.pic2.ScaleMode = 3
form1.pic2.Cls '图片框清空
Set picf = LoadPicture("1.bmp")
For i = 0 To m - 1
For j = 0 To n - 1
form1.pic2.PaintPicture picf, j * 16, i * 16 '加载图片
Next
Next
form1.pic2.Enabled = True
form1.Timer1.Enabled = False '开始时记时器不记时
intNum = 0
inthang = m
intlie = n
intlei = l
form1.PictureClip1.Picture = LoadPicture("face.bmp")
form1.PictureClip1.Rows = 1
form1.PictureClip1.Cols = 5
form1.PictureClip2.Picture = LoadPicture("number.bmp")
form1.PictureClip2.Rows = 1
form1.PictureClip2.Cols = 12
form1.PictureClip3.Picture = LoadPicture("mine.bmp")
form1.PictureClip3.Rows = 1
form1.PictureClip3.Cols = 15
form1.image1.Picture = form1.PictureClip1.GraphicCell(4)
form1.imglei(0).Picture = form1.PictureClip2.GraphicCell(11 - l \ 100) '得到l 的百位
form1.imglei(1).Picture = form1.PictureClip2.GraphicCell(11 - l \ 10 Mod 10) '得到l的十位
form1.imglei(2).Picture = form1.PictureClip2.GraphicCell(11 - l Mod 10) '得到l的个位
For i = 0 To 2
form1.imgtime(i).Left = form1.pic1.Width - 240 - form1.imglei(Abs(i - 2)).Left '与时间显示与雷数显示对称
Next
form1.imgtime(0).Picture = form1.PictureClip2.GraphicCell(11)
form1.imgtime(1).Picture = form1.PictureClip2.GraphicCell(11)
form1.imgtime(2).Picture = form1.PictureClip2.GraphicCell(11)
Randomize
ReDim arrMine(inthang, intlie)
Do While int3 < intlei '雷数的随机分布
col = Int(Rnd * intlie)
ln = Int(Rnd * inthang)
If arrMine(ln, col) = False Then
arrMine(ln, col) = True
int3 = int3 + 1
End If
Loop
ReDim Sign(1 To inthang, 1 To intlie)
ReDim a(0 To inthang - 1, 0 To intlie - 1)
k = intlei: h = intlei
End Sub
form1:
Option Explicit
Private m As Integer, n As Integer
Private Sub image1_Click()
Call sub1(inthang, intlie, intlei)
End Sub
Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
image1.Picture = PictureClip1.GraphicCell(4)
End Sub
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
image1.Picture = PictureClip1.GraphicCell(0)
imgtime(0).Picture = PictureClip2.GraphicCell(11)
imgtime(1).Picture = PictureClip2.GraphicCell(11)
imgtime(2).Picture = PictureClip2.GraphicCell(11)
Timer1.Enabled = False
intNum = 0
End Sub
Private Sub end_Click()
Unload frmMinemain
End Sub
Private Sub Form_Load()
Call sub1(9, 9, 10)
End Sub
Private Sub beginner_Click()
Call sub1(9, 9, 10)
End Sub
Private Sub middle_Click()
Call sub1(16, 16, 40)
End Sub
Private Sub refer_Click()
Load frmAbout
frmAbout.Show 1
End Sub
Private Sub senior_Click()
Call sub1(16, 30, 99)
End Sub
Private Sub selfcontrol_Click()
Load frmselfcontrol
frmselfcontrol.Show 1
End Sub
Private Sub Pic1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
image1.Picture = PictureClip1.GraphicCell(3)
End Sub
Private Sub Pic1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
image1.Picture = PictureClip1.GraphicCell(4)
End Sub
Private Sub Pic2_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 1 Then
Timer1.Enabled = True
image1.Picture = PictureClip1.GraphicCell(3)
int2 = x \ 16
int1 = y \ 16
PictureClip3.Picture = LoadPicture("mine.bmp")
PictureClip3.Rows = 1
PictureClip3.Cols = 16
If a(int1, int2) = 1 Then Exit Sub
If arrMine(int1, int2) Then
Timer1.Enabled = False
image1.Picture = PictureClip1.GraphicCell(2)
Exit Sub
End If
If leishu(int1 + 1, int2 + 1) <> 0 Then
pic2.PaintPicture PictureClip3.GraphicCell(15 - leishu(int1 + 1, int2 + 1)), int2 * 16, int1 * 16
Exit Sub
Else
pic2.PaintPicture PictureClip3.GraphicCell(15), int2 * 16, int1 * 16
Call fankai(int1 + 1, int2 + 1)
End If
Else
int2 = x \ 16
int1 = y \ 16
If Sign(int1 + 1, int2 + 1) = False Then
a(int1, int2) = a(int1, int2) + 1
If a(int1, int2) Mod 3 = 1 Then
pic2.PaintPicture PictureClip3.GraphicCell(1), int2 * 16, int1 * 16
k = k - 1
End If
If a(int1, int2) Mod 3 = 2 Then
pic2.PaintPicture PictureClip3.GraphicCell(2), int2 * 16, int1 * 16
k = k + 1
End If
If a(int1, int2) Mod 3 = 0 Then
pic2.PaintPicture PictureClip3.GraphicCell(0), int2 * 16, int1 * 16 End If
If k >= 0 Then
imglei(0).Picture = form1.PictureClip2.GraphicCell(11 - k \ 100)
imglei(1).Picture = form1.PictureClip2.GraphicCell(11 - k \ 10 Mod 10)
imglei(2).Picture = form1.PictureClip2.GraphicCell(11 - k Mod 10) Else
imglei(0).Picture = form1.PictureClip2.GraphicCell(0)
imglei(1).Picture = form1.PictureClip2.GraphicCell(11 + k \ 10 Mod 10)
imglei(2).Picture = form1.PictureClip2.GraphicCell(11 + k Mod 10) End If
End If
If arrMine(int1, int2) Then
h = h - 1
If h = 0 And k = 0 Then
MsgBox "胜利,恭喜你!", 32, "扫雷"
image1.Picture = PictureClip1.GraphicCell(1)
Timer1.Enabled = False
pic2.Enabled = False
Dim str1(2) As String, str2(2) As Integer, str3(2) As String
If inthang = 9 And intlie = 9 Then
Open App.Path & "\chuji.txt" For Input As 1
Line Input #1, str1(0)
str2(0) = CInt(Left(str1(0), InStr(str1(0), " ")))
If intNum < CInt(str2(0)) Then
InputBox " 恭喜你破了本难度的记录!请留下大名", , "无名侠"
End If
Close 1
ElseIf intlie = 16 And inthang = 9 Then
Open App.Path & "\zhongji.txt" For Input As 1
Line Input #1, str1(1)
str2(1) = CInt(Left(str1(1), InStr(str1(1), " ")))
If intNum < CInt(str2(1)) Then
InputBox " 恭喜你破了本难度的记录!请留下大名", , "无名侠"
End If
Close 1
ElseIf intlie = 30 And inthang = 16 Then
Open App.Path & "\gaoji.txt" For Input As 1
Line Input #1, str1(2)
str2(2) = CInt(Left(str1(2), InStr(str1(2), " ")))
If intNum < CInt(str2(2)) Then
InputBox " 恭喜你破了本难度的记录!请留下大名", , "无名侠"
End If
Close 1
End If
End If
End If
End If
End Sub
Private Sub fankai(ByVal int1 As Integer, ByVal int2 As Integer)
Dim hang As Integer
Dim lie As Integer
Top:
If int1 - 1 = 0 Then GoTo Below
If Sign(int1 - 1, int2) = False Then
Sign(int1 - 1, int2) = True
hang = int1 - 1
lie = int2
GoTo Ddd
End If
Below:
If int1 = inthang Then GoTo Left
If Sign(int1 + 1, int2) = False Then
Sign(int1 + 1, int2) = True
hang = int1 + 1
lie = int2
GoTo Ddd
End If
Left:
If int2 - 1 = 0 Then GoTo Right
If Sign(int1, int2 - 1) = False Then
Sign(int1, int2 - 1) = True
lie = int2 - 1
hang = int1
GoTo Ddd
End If
Right:
If int2 = intlie Then GoTo Righttop
If Sign(int1, int2 + 1) = False Then
Sign(int1, int2 + 1) = True
lie = int2 + 1
hang = int1
GoTo Ddd
End If
Righttop:
If int2 = intlie Or int1 - 1 = 0 Then GoTo Lefttop
If Sign(int1 - 1, int2 + 1) = False Then
Sign(int1 - 1, int2 + 1) = True
lie = int2 + 1
hang = int1 - 1
GoTo Ddd
End If
Lefttop:
If int2 = 1 Or int1 - 1 = 0 Then GoTo Leftbelow
If Sign(int1 - 1, int2 - 1) = False Then
Sign(int1 - 1, int2 - 1) = True
lie = int2 - 1
hang = int1 - 1
GoTo Ddd
End If
Leftbelow:
If int2 = 1 Or int1 = inthang Then GoTo Rightbelow If Sign(int1 + 1, int2 - 1) = False Then
Sign(int1 + 1, int2 - 1) = True
lie = int2 - 1
hang = int1 + 1
GoTo Ddd
End If
Rightbelow:
If int2 = intlie Or int1 = inthang Then Exit Sub
If Sign(int1 + 1, int2 + 1) = False Then
Sign(int1 + 1, int2 + 1) = True
lie = int2 + 1
hang = int1 + 1
GoTo Ddd
Else
Exit Sub
End If
Ddd:
If leishu(hang, lie) <> 0 Then
pic2.PaintPicture PictureClip3.GraphicCell(15 - leishu(hang, lie)), (lie - 1) * 16, (hang - 1) * 16
GoTo Top
Else
pic2.PaintPicture PictureClip3.GraphicCell(15), (lie - 1) * 16, (hang - 1) * 16
Call fankai(hang, lie)
GoTo Top
End If
End Sub
Private Function leishu(hang As Integer, lie As Integer) As Integer
leishu = 0
If hang - 1 >= 1 And lie - 1 >= 1 Then
If arrMine(hang - 1 - 1, lie - 1 - 1) Then
leishu = leishu + 1
End If
End If
If hang >= 1 And lie - 1 >= 1 Then
If arrMine(hang - 1, lie - 1 - 1) Then
leishu = leishu + 1
End If
End If
If hang - 1 >= 1 And lie >= 1 Then
If arrMine(hang - 1 - 1, lie - 1) Then
leishu = leishu + 1
End If
End If
If hang + 1 <= inthang And lie + 1 <= intlie Then
If arrMine(hang - 1 + 1, lie - 1 + 1) Then
leishu = leishu + 1
End If
End If
If hang + 1 <= inthang And lie >= 1 Then
If arrMine(hang - 1 + 1, lie - 1) Then
leishu = leishu + 1
End If
End If
If hang >= 1 And lie + 1 <= intlie Then
If arrMine(hang - 1, lie - 1 + 1) Then
leishu = leishu + 1
End If
End If
If hang - 1 >= 1 And lie + 1 <= intlie Then
If arrMine(hang - 1 - 1, lie - 1 + 1) Then
leishu = leishu + 1
End If
End If
If hang + 1 <= inthang And lie - 1 >= 1 Then
If arrMine(hang - 1 + 1, lie - 1 - 1) Then
leishu = leishu + 1
End If
End If
End Function
Private Sub Pic2_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
int1 = y \ 16
int2 = x \ 16
If Button = 1 Then
If a(int1, int2) = 1 Then Exit Sub
If arrMine(int1, int2) Then
image1.Picture = PictureClip1.GraphicCell(2)
pic2.Enabled = False
Timer1.Enabled = False
pic2.PaintPicture PictureClip3.GraphicCell(3), int2 * 16, int1 * 16
For i = 0 To inthang - 1
For j = 0 To intlie - 1
If i = int1 And j = int2 Then GoTo l1
If a(i, j) = 1 Then
If arrMine(i, j) Then
pic2.PaintPicture PictureClip3.GraphicCell(1), j * 16, i * 16
Else
pic2.PaintPicture PictureClip3.GraphicCell(4), j * 16, i * 16
End If
Else
If arrMine(i, j) Then
pic2.PaintPicture PictureClip3.GraphicCell(5), j * 16, i * 16
End If
End If
l1:
Next
Next
Else
image1.Picture = PictureClip1.GraphicCell(4)
End If
End If
End Sub
Private Sub herolist_Click()
Timer1.Enabled = False
Load frmherolist
frmherolist.Show 1
End Sub
Private Sub start_Click()
Call sub1(inthang, intlie, intlei)
End Sub
Private Sub Timer1_Timer()
intNum = intNum + 1
Select Case intNum
Case Is < 10
imgtime(2).Picture = PictureClip2.GraphicCell(11 - intNum) Case Is < 100
imgtime(2).Picture = PictureClip2.GraphicCell(11 - intNum Mod 10)
imgtime(1).Picture = PictureClip2.GraphicCell(11 - intNum \ 10) Case Is < 1000
imgtime(0).Picture = PictureClip2.GraphicCell(11 - intNum \ 100)
imgtime(1).Picture = PictureClip2.GraphicCell(11 - intNum \ 10 Mod 10)
imgtime(2).Picture = PictureClip2.GraphicCell(11 - intNum Mod 10)
Case Else
Timer1.Enabled = False
End Select
End Sub。

相关文档
最新文档