当前位置: 网学 > 编程文档 > VB > 正文

VB扫雷源代码

来源:Http://myeducs.cn 联系QQ:点击这里给我发消息 作者: 用户投稿 来源: 网络 发布时间: 12/10/16
下载{$ArticleTitle}原创论文样式
)
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
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

Exit Sub
''--------------------------
For X = 1 To NowWidth
    For Y = 1 To NowHeight
        If What(X, Y) = 10 Then
           Picture1.PaintPicture image1(13).Picture, X - 1, Y - 1
        ElseIf What(X, Y) >= 1 And What(X, Y) <= 9 Then
           Picture1.PaintPicture image1(What(X, Y)).Picture, X - 1, Y - 1
        Else
           Picture1.PaintPicture image1(9).Picture, X - 1, Y - 1
        End If
    Next
Next
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
   &nbs

网学推荐

免费论文

原创论文

浏览:
设为首页 | 加入收藏 | 论文首页 | 论文专题 | 设计下载 | 网学软件 | 论文模板 | 论文资源 | 程序设计 | 关于网学 | 站内搜索 | 网学留言 | 友情链接 | 资料中心
版权所有 QQ:3710167 邮箱:3710167@qq.com 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
Copyright 2008-2015 myeducs.Cn www.myeducs.Cn All Rights Reserved
湘ICP备09003080号