Timer1.Enabled = True
Timer1.Interval = 100
starttime = Hour(Time()) * 3600 + Minute(Time()) * 60 + Second(Time())
Else
'退出游戏
End
End If
End Sub
5 图像框
Private Sub Image1_Click(Index As Integer)
'鼠标单击图像框时,调用自定义函数empty_do
Call empty_do(Picture1(Index), Picture1(9))
End Sub
6 时钟响应
Private Sub Timer1_Timer()
'时钟响应时,重置标签Caption属性
Label1.Caption = "战况:" + Trim(Str(Hour(Time()) * 3600 + Minute(Time()) * 60 + Second(Time()) - starttime)) + "秒"
End Sub
7 自定义两个函数
(1)交换图片框位置函数:jiaohuan(pic1,pic2)
Private Function jiaohuan(pic1 As PictureBox, pic2 As PictureBox)
'交换图片位置
Dim a, b As Integer
a = pic1.Left
b = pic1.Top
pic1.Left = pic2.Left
pic1.Top = pic2.Top
pic2.Left = a
pic2.Top = b
End Function
|