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

📄 mine.frm

📁 vb精彩编程希望大家有用
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "扫雷"
   ClientHeight    =   4245
   ClientLeft      =   4230
   ClientTop       =   3555
   ClientWidth     =   6990
   LinkTopic       =   "Form1"
   ScaleHeight     =   4245
   ScaleWidth      =   6990
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Interval        =   1000
      Left            =   3720
      Top             =   240
   End
   Begin VB.CommandButton Command1 
      Caption         =   "开始游戏"
      Height          =   495
      Left            =   480
      TabIndex        =   1
      Top             =   120
      Width           =   1215
   End
   Begin VB.PictureBox Picture1 
      AutoRedraw      =   -1  'True
      Enabled         =   0   'False
      Height          =   3375
      Left            =   120
      ScaleHeight     =   3315
      ScaleWidth      =   6315
      TabIndex        =   0
      Top             =   720
      Width           =   6375
   End
   Begin VB.Image Image1 
      Height          =   240
      Index           =   14
      Left            =   6600
      Picture         =   "mine.frx":0000
      Top             =   3960
      Visible         =   0   'False
      Width           =   240
   End
   Begin VB.Image Image1 
      Height          =   240
      Index           =   13
      Left            =   6600
      Picture         =   "mine.frx":200E
      Top             =   3720
      Visible         =   0   'False
      Width           =   240
   End
   Begin VB.Image Image1 
      Height          =   240
      Index           =   12
      Left            =   6600
      Picture         =   "mine.frx":41BA
      Top             =   3480
      Visible         =   0   'False
      Width           =   240
   End
   Begin VB.Image Image1 
      Height          =   240
      Index           =   11
      Left            =   6600
      Picture         =   "mine.frx":61C8
      Top             =   3240
      Visible         =   0   'False
      Width           =   240
   End
   Begin VB.Image Image1 
      Height          =   240
      Index           =   10
      Left            =   6600
      Picture         =   "mine.frx":8308
      Top             =   3000
      Visible         =   0   'False
      Width           =   240
   End
   Begin VB.Image Image1 
      Height          =   240
      Index           =   9
      Left            =   6600
      Picture         =   "mine.frx":A462
      Top             =   2760
      Visible         =   0   'False
      Width           =   240
   End
   Begin VB.Image Image1 
      Height          =   240
      Index           =   8
      Left            =   6600
      Picture         =   "mine.frx":C4D8
      Top             =   2520
      Visible         =   0   'False
      Width           =   240
   End
   Begin VB.Image Image1 
      Height          =   240
      Index           =   7
      Left            =   6600
      Picture         =   "mine.frx":E6A6
      Top             =   2280
      Visible         =   0   'False
      Width           =   240
   End
   Begin VB.Image Image1 
      Height          =   240
      Index           =   6
      Left            =   6600
      Picture         =   "mine.frx":10826
      Top             =   2040
      Visible         =   0   'False
      Width           =   240
   End
   Begin VB.Image Image1 
      Height          =   240
      Index           =   5
      Left            =   6600
      Picture         =   "mine.frx":129CE
      Top             =   1800
      Visible         =   0   'False
      Width           =   240
   End
   Begin VB.Image Image1 
      Height          =   240
      Index           =   4
      Left            =   6600
      Picture         =   "mine.frx":14B7E
      Top             =   1560
      Visible         =   0   'False
      Width           =   240
   End
   Begin VB.Image Image1 
      Height          =   240
      Index           =   3
      Left            =   6600
      Picture         =   "mine.frx":16D20
      Top             =   1320
      Visible         =   0   'False
      Width           =   240
   End
   Begin VB.Image Image1 
      Height          =   240
      Index           =   2
      Left            =   6600
      Picture         =   "mine.frx":18ED2
      Top             =   1080
      Visible         =   0   'False
      Width           =   240
   End
   Begin VB.Image Image1 
      Height          =   240
      Index           =   1
      Left            =   6600
      Picture         =   "mine.frx":1B078
      Top             =   840
      Visible         =   0   'False
      Width           =   240
   End
   Begin VB.Image Image1 
      Height          =   240
      Index           =   0
      Left            =   6600
      Picture         =   "mine.frx":1D203
      Top             =   600
      Visible         =   0   'False
      Width           =   240
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "加油,祝你好运!"
      Height          =   180
      Left            =   2160
      TabIndex        =   4
      Top             =   270
      Width           =   1350
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      ForeColor       =   &H000000FF&
      Height          =   375
      Left            =   6000
      TabIndex        =   3
      Top             =   180
      Width           =   855
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Height          =   375
      Left            =   5520
      TabIndex        =   2
      Top             =   180
      Width           =   375
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'标志说明
'           0 ~  9 未打开的
'          -1 ~ -9 已打开的
'           10      雷
'           11      已打开的空(未判断)
'           12      已打开的空(已判断)
'           13      标记过的
'           14      问号
'
Dim What(1 To 30, 1 To 16) As Long     '点
Dim Save(1 To 30, 1 To 16) As Long     '存
Dim mX As Long
Dim mY As Long                      '坐标
Dim mTime As Long
Dim MineFlag As Long                '标记雷
Dim OpenFlag As Long                '已打开的
Dim NowWidth As Long
Dim NowHeight As Long
Dim TotMine As Long                 '总雷数
Private Sub Command1_Click()
    Timer1.Enabled = True
    Picture1.Enabled = True
    Label2 = "00:00"
    Label1 = TotMine
    Label3 = "加油哦,祝你好运!!!"
    Picture1.Enabled = True
    For X = 0 To NowWidth - 1
        For Y = 0 To NowHeight - 1
            Picture1.PaintPicture Image1(9).Picture, X, Y
        Next
    Next
    ClearStart NowWidth, NowHeight, TotMine
    WriteNumber NowWidth, NowHeight
End Sub
Private Sub Form_Load()
    Dim X As Long
    Dim Y As Long
    Show
    NowHeight = 16
    NowWidth = 30
    TotMine = 40
    Picture1.Height = (Image1(0).Height) * NowHeight
    Picture1.Width = (Image1(0).Width) * NowWidth
    Form1.Height = Picture1.Height + 1250
    Form1.Width = Picture1.Width + 400
    Picture1.ScaleMode = 3
    Picture1.ScaleHeight = NowHeight
    Picture1.ScaleWidth = NowWidth
    For X = 0 To NowWidth - 1
        For Y = 0 To NowHeight - 1
            Picture1.PaintPicture Image1(9).Picture, X, Y
        Next
    Next
    ClearStart NowWidth, NowHeight, TotMine
    WriteNumber NowWidth, NowHeight
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, _
    X As Single, Y As Single)
    Dim T As Long
    Dim X1 As Long
    Dim Y1 As Long
    Dim x2 As Single
    Dim y2 As Single
    mX = Int(X)
    mY = Int(Y)
    If Button = vbLeftButton Then
       '左键按下
       If What(mX + 1, mY + 1) >= 0 And What(mX + 1, mY + 1) <= 10 Then
          Picture1.PaintPicture Image1(14).Picture, mX, mY
       End If
    ElseIf Button = vbRightButton Then
       '右键按下
       '只有是打开的才处理
     If What(mX + 1, mY + 1) >= -9 And What(mX + 1, mY + 1) <= -1 Then
       T = 0
       '计算标记的雷
       For X1 = mX To mX + 2
           For Y1 = mY To mY + 2
               If X1 = mX + 1 And Y1 = mY + 1 Then
               Else
                  If X1 >= 1 And X1 <= NowWidth Then
                     If Y1 >= 1 And Y1 <= NowHeight Then
                        If What(X1, Y1) = 13 Then
                           T = T + 1
                        End If
                     End If
                  End If
               End If
           Next
       Next
       '如果标记数大于等于雷数则不处理
       If T >= -(What(mX + 1, mY + 1)) Then Exit Sub
       '如果标记数等于雷数则打开
       If T = -What(mX + 1, mY + 1) Then
       For X1 = mX To mX + 2

⌨️ 快捷键说明

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