您好,欢迎光临本网站![请登录][注册会员]  
文件名称: VB的的的的的的扫雷
  所属分类: VB
  开发工具:
  文件大小: 36kb
  下载次数: 0
  上传时间: 2008-11-27
  提 供 者: wxf6*****
 详细说明: Dim b As Single Dim a(9, 9) As Integer Dim b1(9, 9) As Integer Dim b2(9, 9) As Integer Dim cmd(9, 9) As CommandButton Dim lab(9, 9) As Label Private Sub Command1_Click(Index As Integer) x = Index: i = x \ 10: j = x Mod 10 If a(i, j) = 1 Then Call baozha ElseIf leishu(i, j) = 0 Then Call fan(i, j) Else cmd(i, j).Visible = False End If End Sub Private Sub Command1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single) If Button = 2 Then n = Index: i = n \ 10: j = n Mod 10 If cmd(i, j).Caption = "?" Then cmd(i, j).Caption = "" Me.Tag = Me.Tag + 1: Text1.Text = Me.Tag If a(i, j) = 1 Then b1(i, j) = 1 Else cmd(i, j).Caption = "?" Me.Tag = Me.Tag - 1: Text1.Text = Me.Tag End If End If If Me.Tag = 0 Then Call jianyan End Sub Private Sub Command2_Click() Picture1.Enabled = True For i = 0 To 9 For j = 0 To 9 a(i, j) = 0 cmd(i, j).Visible = True cmd(i, j).Caption = "" Next Next Call bulei(b) End Sub Private Sub Command3_Click() b = 10 Picture1.Enabled = True For i = 0 To 9 For j = 0 To 9 a(i, j) = 0 cmd(i, j).Visible = True cmd(i, j).Caption = "" Next Next b = 10 Call bulei(b) End Sub Private Sub Command4_Click() b = 10 Picture1.Enabled = True For i = 0 To 9 For j = 0 To 9 a(i, j) = 0 cmd(i, j).Visible = True cmd(i, j).Caption = "" Next Next b = 15 Call bulei(b) End Sub Private Sub Command5_Click() b = 10 Picture1.Enabled = True For i = 0 To 9 For j = 0 To 9 a(i, j) = 0 cmd(i, j).Visible = True cmd(i, j).Caption = "" Next Next b = 20 Call bulei(b) End Sub Private Sub Form_Load() b = 10 Picture1.Move 0, 0 Picture1.Height = (Command1(0).Height + 5) * 10 + 3 Picture1.Width = (Command1(0).Height + 5) * 10 + 3 Me.Height = Picture1.Height + 560 Me.Width = Picture1.Width + Frame1.Width + 260 Label1(0).Move 0, 0 Command1(0).Move 0, 0 Frame1.Move Picture1.Width + 60, 650 Command3.Move Picture1.Width + 80, 100 Command4.Move Picture1.Width + 180 + 375, 100 Command5.Move Picture1.Width + 280 + 750, 100 Set lab(0, 0) = Label1(0) Set cmd(0, 0) = Command1(0) For n = 1 To 99 i = n \ 10: j = n Mod 10 Load Label1(n) Set lab(i, j) = Label1(n) Load Command1(n) Set cmd(i, j) = Command1(n) With lab(i, j) .Left = 5 + j * lab(0, 0).Width .Top = 5 + i * lab(0, 0).Height .Visible = True End With With cmd(i, j) .Left = 5 + j * cmd(0, 0).Width .Top = 5 + i * cmd(0, 0).Height .Visible = True End With Next Call bulei(b) End Sub Private Sub bulei(b) Dim i, j, k As Integer Randomize For n = 1 To b k = Int(Rnd * (100 - n)) + 1 i = k \ 10: j = k Mod 10 Do While a(i, j) = 1 k = Int(Rnd * (100 - n)) + 1 i = k \ 10: j = k Mod 10 Loop a(i, j) = 1: b1(i, j) = 1 Next For i = 0 To 9 For j = 0 To 9 b2(i, j) = leishu(i, j) Select Case b2(i, j) Case 1 lab(i, j).ForeColor = RGB(0, 0, 255) Case 2 lab(i, j).ForeColor = RGB(255, 0, 0) Case 3 lab(i, j).ForeColor = RGB(0, 127, 0) Case 4 lab(i, j).ForeColor = RGB(0, 255, 255) Case 5 lab(i, j).ForeColor = RGB(255, 255, 0) Case Else lab(i, j).ForeColor = RGB(255, 0, 255) End Select lab(i, j).Caption = IIf(b2(i, j) = 0, "", b2(i, j)) Next Next Label2.Caption = "游戏开始" Me.Tag = b: Text1.Text = b End Sub Private Function leishu(x, y) k = 0 For i = IIf(x = 0, 0, x - 1) To IIf(x = 9, 9, x + 1) For j = IIf(y = 0, 0, y - 1) To IIf(y = 9, 9, y + 1) k = k + a(i, j) Next Next leishu = k End Function Private Sub baozha() For i = 0 To 9 For j = 0 To 9 If a(i, j) = 1 Then cmd(i, j).Caption = "!" Next Next Picture1.Enabled = False Label2.Caption = "你输了!" End Sub Private Sub jianyan() For i = 0 To 9 For j = 0 To 9 If a(i, j) = 1 And cmd(i, j).Caption = "" Then Exit Sub If cmd(i, j).Caption = "" Then cmd(i, j).Visible = False Next Next Picture1.Enabled = False Label2.Caption = "你赢了!" End Sub Private Sub fan(x, y) For i = IIf(x = 0, 0, x - 1) To IIf(x = 9, 9, x + 1) For j = IIf(y = 0, 0, y - 1) To IIf(y = 9, 9, y + 1) If cmd(i, j).Visible = True Then cmd(i, j).Visible = False If leishu(i, j) = 0 Then Call fan(i, j) End If Next Next End Sub ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: 123
 输入关键字,在本站1000多万海量源码库中尽情搜索: