VB实现 扫雷

想题目是什么想了半天 什么导弹炸弹 原来是扫雷啊

Public Sub New(ByVal m As Integer, ByVal n As Integer) MineMatrix = New clsMineMatrix(m, n, 10) Buttons = New List(Of Button) Me.M = m : Me.N = n For i = 0 To m - 1 For j = 0 To n - 1 Dim ButtonX As Button = New Button With ButtonX .Location = New System.Drawing.Point(MarginX + w * j, MarginY + i * w) .Name = "Button " & i & " " & j 'Button 2 3 .Size = New System.Drawing.Size(w, w) .Text = "" .UseVisualStyleBackColor = True AddHandler ButtonX.Click, AddressOf ButtonX_Click End With Buttons.Add(ButtonX) Next Next End Sub Private Sub ButtonX_Click(ByVal sender As Object, ByVal e As EventArgs) Dim ij() As String = sender.name.split(" ") Dim i As Integer = ij(1), j As Integer = ij(2) MsgBox(i & "," & j) End Sub

要添加的功能:

  • 点击显示 周围八个数字或是雷
  • 点击 到雷 游戏结束 显示全部
  • 把位置在右边的编辑框中显示出来
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容