Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single,
Y As Single)
If Button = vbLeftButton Then
''左击
If What(mX + 1, mY + 1) = 10 Then
''点到雷
Timer1.Enabled = False
Picture1.PaintPicture image1(13).Picture, mX, mY
Picture1.Enabled = False
Label3 = "哇!你点到雷了呀!重来吧!!!"
EndGame
Timer1 = False
Picture1.Enabled = False
Exit Sub
ElseIf What(mX + 1, mY + 1) >= 1 And What(mX + 1, mY + 1) <= 9 Then
''点到数字
OpenFlag = OpenFlag + 1
Picture1.PaintPicture image1(What(mX + 1, mY + 1)).Picture, mX, mY
What(mX + 1, mY + 1) = -What(mX + 1, mY + 1)
ElseIf What(mX + 1, mY + 1) = 0 Then
''点到空
Picture1.PaintPicture image1(0).Picture, mX, mY
What(mX + 1, mY + 1) = 11
OpenBlank mX + 1, mY + 1
End If
If MineFlag + OpenFlag = NowHeight * NowWidth Then
Label3 = "恭喜恭喜!你过关了!"
Timer1.Enabled = False
Picture1.Enabled = False
End If
ElseIf Button = vbRightButton Then
''右击
If What(mX + 1, mY + 1) >= 0 And What(mX + 1, mY + 1) <= 10 Then
''未标记过的进行标记
Save(mX + 1, mY + 1) = What(mX + 1, mY + 1)
What(mX + 1, mY + 1) = 13
Picture1.PaintPicture image1(10).Picture, mX, mY
MineFlag = MineFlag + 1
Label1 = TotMine - MineFlag
ElseIf What(mX + 1, mY + 1) = 13 Then
''已经标记过则改为?
What(mX + 1, mY + 1) = 14
MineFlag = MineFlag - 1
Label1 = TotMine - MineFlag
Picture1.PaintPicture image1(11).Picture, mX, mY
ElseIf What(mX + 1, mY + 1) = 14 Then
''标记过?号的则
What(mX + 1, mY + 1) = Save(mX + 1, mY + 1)
Picture1.PaintPicture image1(9).Picture, mX, mY
End If
End If
End Sub
Private Sub ClearStart(ByVal mWidth As Long, ByVal mHeight As Long, ByVal
MineNumber As Long)
''预置雷位置
Randomize
mTime