⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 扫雷游戏VB实现 扫雷游戏VB实现
💻 FRM
📖 第 1 页 / 共 2 页
字号:
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Index           =   25
      Left            =   720
      TabIndex        =   25
      Top             =   1200
      Width           =   255
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Index           =   24
      Left            =   2400
      TabIndex        =   24
      Top             =   960
      Width           =   255
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Index           =   23
      Left            =   2160
      TabIndex        =   23
      Top             =   960
      Width           =   255
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Index           =   22
      Left            =   1920
      TabIndex        =   22
      Top             =   960
      Width           =   255
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Index           =   21
      Left            =   1680
      TabIndex        =   21
      Top             =   960
      Width           =   255
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Index           =   20
      Left            =   1440
      TabIndex        =   20
      Top             =   960
      Width           =   255
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Index           =   19
      Left            =   1200
      TabIndex        =   19
      Top             =   960
      Width           =   255
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Index           =   18
      Left            =   960
      TabIndex        =   18
      Top             =   960
      Width           =   255
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Index           =   17
      Left            =   720
      TabIndex        =   17
      Top             =   960
      Width           =   255
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Index           =   16
      Left            =   2400
      TabIndex        =   16
      Top             =   720
      Width           =   255
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Index           =   15
      Left            =   2160
      TabIndex        =   15
      Top             =   720
      Width           =   255
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Index           =   14
      Left            =   1920
      TabIndex        =   14
      Top             =   720
      Width           =   255
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Index           =   13
      Left            =   1680
      TabIndex        =   13
      Top             =   720
      Width           =   255
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Index           =   12
      Left            =   1440
      TabIndex        =   12
      Top             =   720
      Width           =   255
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Index           =   11
      Left            =   1200
      TabIndex        =   11
      Top             =   720
      Width           =   255
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Index           =   10
      Left            =   960
      TabIndex        =   10
      Top             =   720
      Width           =   255
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Index           =   9
      Left            =   720
      TabIndex        =   9
      Top             =   720
      Width           =   255
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Index           =   8
      Left            =   2400
      TabIndex        =   8
      Top             =   480
      Width           =   255
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Index           =   7
      Left            =   2160
      TabIndex        =   7
      Top             =   480
      Width           =   255
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Index           =   6
      Left            =   1920
      TabIndex        =   6
      Top             =   480
      Width           =   255
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Index           =   5
      Left            =   1680
      TabIndex        =   5
      Top             =   480
      Width           =   255
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Index           =   4
      Left            =   1440
      TabIndex        =   4
      Top             =   480
      Width           =   255
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Index           =   3
      Left            =   1200
      TabIndex        =   3
      Top             =   480
      Width           =   255
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Index           =   2
      Left            =   960
      TabIndex        =   2
      Top             =   480
      Width           =   255
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Index           =   1
      Left            =   720
      TabIndex        =   1
      Top             =   480
      Width           =   255
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000018&
      BorderStyle     =   1  'Fixed Single
      ForeColor       =   &H80000008&
      Height          =   255
      Index           =   0
      Left            =   1320
      TabIndex        =   0
      Top             =   2760
      Width           =   255
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim X, Y As Integer
Dim leiX(100) As Integer
Dim leiY(100) As Integer
Dim P As Integer
Dim Lshu As Integer
Dim sHuju(64) As String
Private Sub Command1_Click()
Lshu = 15
Randomize

Do While P < Lshu
    P = P + 1
10
    X = Int(Rnd * 8 + 1)
    Y = Int(Rnd * 8 + 1)
For i = 1 To Lshu
    If leiX(i) = X And leiY(i) = Y Then GoTo 10
Next i
leiX(P) = X
leiY(P) = Y
Format X
Format Y
Loop
For i = 1 To Lshu
    sHuju((leiY(i) - 1) * 8 + leiX(i)) = "#"
Next i
Dim zWls As Integer
For i = 1 To 64
If sHuju(i) = "#" Then GoTo 100
    If i Mod 8 = 1 Then
        If i = 1 Then
            If sHuju(2) = "#" Then zWls = zWls + 1
            If sHuju(9) = "#" Then zWls = zWls + 1
            If sHuju(10) = "#" Then zWls = zWls + 1
            sHuju(1) = zWls
            zWls = 0
            GoTo 20
        End If
        If i = 57 Then
            If sHuju(49) = "#" Then zWls = zWls + 1
            If sHuju(50) = "#" Then zWls = zWls + 1
            If sHuju(58) = "#" Then zWls = zWls + 1
            sHuju(57) = zWls
            zWls = 0
            GoTo 20
       End If
        If sHuju(i - 8) = "#" Then zWls = zWls + 1
        If sHuju(i + 8) = "#" Then zWls = zWls + 1
        If sHuju(i + 1) = "#" Then zWls = zWls + 1
        If sHuju(i - 7) = "#" Then zWls = zWls + 1
        If sHuju(i + 9) = "#" Then zWls = zWls + 1
        sHuju(i) = zWls
        zWls = 0
20
        GoTo 100
    End If
    If i Mod 8 = 0 Then
        If i = 8 Then
            If sHuju(7) = "#" Then zWls = zWls + 1
            If sHuju(15) = "#" Then zWls = zWls + 1
            If sHuju(16) = "#" Then zWls = zWls + 1
            sHuju(8) = zWls
            zWls = 0
            GoTo 30
       End If
        If i = 64 Then
            If sHuju(63) = "#" Then zWls = zWls + 1
            If sHuju(56) = "#" Then zWls = zWls + 1
            If sHuju(55) = "#" Then zWls = zWls + 1
            sHuju(64) = zWls
            zWls = 0
            GoTo 30
       End If
        If sHuju(i - 8) = "#" Then zWls = zWls + 1
        If sHuju(i + 8) = "#" Then zWls = zWls + 1
        If sHuju(i - 1) = "#" Then zWls = zWls + 1
        If sHuju(i + 7) = "#" Then zWls = zWls + 1
        If sHuju(i - 9) = "#" Then zWls = zWls + 1
        sHuju(i) = zWls
        zWls = 0
30
        GoTo 100

    End If
    If i > 1 And i < 8 Then
        If sHuju(i - 1) = "#" Then zWls = zWls + 1
        If sHuju(i + 1) = "#" Then zWls = zWls + 1
        If sHuju(i + 8) = "#" Then zWls = zWls + 1
        If sHuju(i + 7) = "#" Then zWls = zWls + 1
        If sHuju(i + 9) = "#" Then zWls = zWls + 1
        sHuju(i) = zWls
        zWls = 0
        GoTo 100
    End If
    If i > 57 And i < 64 Then
        If sHuju(i - 1) = "#" Then zWls = zWls + 1
        If sHuju(i + 1) = "#" Then zWls = zWls + 1
        If sHuju(i - 8) = "#" Then zWls = zWls + 1
        If sHuju(i - 7) = "#" Then zWls = zWls + 1
        If sHuju(i - 9) = "#" Then zWls = zWls + 1
        sHuju(i) = zWls
        zWls = 0
        GoTo 100
    End If
        If sHuju(i - 8) = "#" Then zWls = zWls + 1
        If sHuju(i - 9) = "#" Then zWls = zWls + 1
        If sHuju(i - 7) = "#" Then zWls = zWls + 1
        If sHuju(i - 1) = "#" Then zWls = zWls + 1
        If sHuju(i + 1) = "#" Then zWls = zWls + 1
        If sHuju(i + 7) = "#" Then zWls = zWls + 1
        If sHuju(i + 8) = "#" Then zWls = zWls + 1
        If sHuju(i + 9) = "#" Then zWls = zWls + 1
        sHuju(i) = zWls
        zWls = 0
100
Next i
End Sub


Private Sub Command2_Click()
Unload Form1
Load Form1
Form1.Show
End Sub

Private Sub Label1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
If sHuju(Index) = "#" Then
For i = 1 To 64
If sHuju(i) = "#" Then Label1(i).Caption = "#"
Next i
MsgBox "you are lost"
Unload Form1
Load Form1
Form1.Show
Else
Label1(Index).Caption = sHuju(Index)
Label1(Index).Appearance = 0
End If
End If
If Button = 2 Then
    If sHuju(Index) = "#" Then
        Label1(Index).Caption = "#"
    End If
End If
        
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -