【开源】绝对经典的扫雷源码(仿微软扫雷界面)--可以作弊呢!!!
叶帆
博客专家认证
业界专家认证 2004-09-16 06:02:06 '*************************************************************************
'**模 块 名:Form1
'**说 明:叶帆软件 版权所有2002 - 2004(C)
'**创 建 人:叶帆
'**日 期:2002年06月11日
'**修 改 人:
'**日 期:
'**描 述:扫雷原程序
'**版 本:V1.0
'*************************************************************************
Option Explicit
Private Sub Form_Load()
Dim i As Integer, j As Integer
For i = 1 To 24
For j = 1 To 30
If i = 24 And j = 30 Then GoTo exitfor
Load imgLei((i - 1) * 30 + j)
imgLei((i - 1) * 30 + j).Visible = True
Next j, i
exitfor:
'-------------------
If Dir(App.Path + "\yefan.ini") <> "" Then
Open App.Path + "\yefan.ini" For Input As #1
Input #1, jibie
Input #1, leiname(0)
Input #1, leiname(1)
Input #1, leiname(2)
Input #1, leitime(0)
Input #1, leitime(1)
Input #1, leitime(2)
Input #1, LeiRow
Input #1, LeiCol
Input #1, LeiNums
Close #1
Else
jibie = 1
leiname(0) = "佚名"
leiname(1) = "佚名"
leiname(2) = "佚名"
leitime(0) = "999"
leitime(1) = "999"
leitime(2) = "999"
End If
Select Case jibie
Case 1
Menu_B_Click
Case 2
Menu_I_Click
Case 3
Menu_E_Click
Case 4
Menu_C_Click
End Select
End Sub
Private Sub ShowLei(i As Integer, j As Integer)
Select Case lei(j, i)
Case 0:
imgLei((i - 1) * LeiCol + j - 1).Picture = ImageList2.ListImages(9).Picture
Case 9:
imgLei((i - 1) * LeiCol + j - 1).Picture = ImageList1.ListImages(2).Picture
Case Else
imgLei((i - 1) * LeiCol + j - 1).Picture = ImageList2.ListImages(lei(j, i)).Picture
End Select
lei1((i - 1) * LeiCol + j - 1) = 1
End Sub
Private Sub ShowShui(col As Integer, row As Integer)
Dim i As Integer, j As Integer
Dim BeginX As Integer, BeginY As Integer
Dim x As Integer, y As Integer
' 清零
For i = 0 To 31
For j = 0 To 25
JieDian(i, j) = 0
Next j, i
'查起始点
j = row
While j > 0 And lei(col, j) <> 0
j = j - 1
Wend
If j <> row Then y = j + 1
x = col
y = j
Shui x, y
'---------------
For i = 1 To LeiRow
For j = 1 To LeiCol
If JieDian(j, i) = 1 Then
If i - 1 > 0 Then ShowLei i - 1, j
If i - 1 > 0 And j - 1 > 0 Then ShowLei i - 1, j - 1
If j - 1 > 0 Then ShowLei i, j - 1
If i + 1 < LeiRow + 1 And j - 1 > 0 Then ShowLei i + 1, j - 1
If i + 1 < LeiRow + 1 Then ShowLei i + 1, j
If i + 1 < LeiRow + 1 And j + 1 < LeiCol + 1 Then ShowLei i + 1, j + 1
If j + 1 < LeiCol + 1 Then ShowLei i, j + 1
If i - 1 > 0 And j + 1 < LeiCol + 1 Then ShowLei i - 1, j + 1
End If
Next j
Next i
'---------------
End Sub
Private Sub Shui(x As Integer, y As Integer)
'算法一
JieDian(x, y) = 1
If y - 1 > 0 And JieDian(x, y - 1) = 0 And lei(x, y - 1) = 0 Then Shui x, y - 1
If y - 1 > 0 And x - 1 > 0 And JieDian(x - 1, y - 1) = 0 And lei(x - 1, y - 1) = 0 Then Shui x - 1, y - 1
If x - 1 > 0 And JieDian(x - 1, y) = 0 And lei(x - 1, y) = 0 Then Shui x - 1, y
If y + 1 < LeiRow + 1 And x - 1 > 0 And JieDian(x - 1, y + 1) = 0 And lei(x - 1, y + 1) = 0 Then Shui x - 1, y + 1
If y + 1 < LeiRow + 1 And JieDian(x, y + 1) = 0 And lei(x, y + 1) = 0 Then Shui x, y + 1
If y + 1 < LeiRow + 1 And x + 1 < LeiCol + 1 And JieDian(x + 1, y + 1) = 0 And lei(x + 1, y + 1) = 0 Then Shui x + 1, y + 1
If x + 1 < LeiCol + 1 And JieDian(x + 1, y) = 0 And lei(x + 1, y) = 0 Then Shui x + 1, y
If y - 1 > 0 And x + 1 < LeiCol + 1 And JieDian(x + 1, y - 1) = 0 And lei(x + 1, y - 1) = 0 Then Shui x + 1, y - 1
End Sub
-------
源码下载地址:
http://blog.csdn.net/yefanqiu
中的【叶帆程序】-扫雷源码