【VB开源代码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。
网学会员整理了VB开源代码-vb_扫雷程序源码 - 其它资料的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
Public Class Form1 Public buttons9 9 As Button Dim g As Graphics Dim p As Pen Private Sub Button85_Click Handles Button85.Click Me.Close End Sub Private Sub Button82_Click Handles Button82.Click Me.Form1_Load End Sub Private Sub Form1_Load Handles MyBase.Load Dim i j As Integer g.DrawEllipsep 20 50 30 30 buttons0 0 Button1 buttons0 1 Button2 buttons0 2 Button3 buttons0 3 Button4 buttons0 4 Button5 buttons0 5 Button6 buttons0 6 Button7 buttons0 7 Button8 buttons0 8 Button9 buttons1 0 Button10 buttons1 1 Button11 buttons1 2 Button12 buttons1 3 Button13 buttons1 4 Button14 buttons1 5 Button15 buttons1 6 Button16 buttons1 7 Button17 buttons1 8 Button18 buttons2 0 Button19 buttons2 1 Button20 buttons2 2 Button21 buttons2 3 Button22 buttons2 4 Button23 buttons2 5 Button24 buttons2 6 Button25 buttons2 7 Button26 buttons2 8 Button27 buttons3 0 Button28 buttons3 1 Button29 buttons3 2 Button30 buttons3 3 Button31buttons3 4 Button32buttons3 5 Button33buttons3 6 Button34buttons3 7 Button35buttons3 8 Button36buttons4 0 Button37buttons4 1 Button38buttons4 2 Button39buttons4 3 Button40buttons4 4 Button41buttons4 5 Button42buttons4 6 Button43buttons4 7 Button44buttons4 8 Button45buttons5 0 Button46buttons5 1 Button47buttons5 2 Button48buttons5 3 Button49buttons5 4 Button50buttons5 5 Button51buttons5 6 Button52buttons5 7 Button53buttons5 8 Button54buttons6 0 Button55buttons6 1 Button56buttons6 2 Button57buttons6 3 Button58buttons6 4 Button59buttons6 5 Button60buttons6 6 Button61buttons6 7 Button62buttons6 8 Button63buttons7 0 Button64buttons7 1 Button65buttons7 2 Button66buttons7 3 Button67buttons7 4 Button68buttons7 5 Button69buttons7 6 Button70buttons7 7 Button71buttons7 8 Button72buttons8 0 Button73buttons8 1 Button74buttons8 2 Button75 buttons8 3 Button76 buttons8 4 Button77 buttons8 5 Button78 buttons8 6 Button79 buttons8 7 Button80 buttons8 8 Button81 For i 0 To 8 For j 0 To 8 buttonsi j.Enabled True buttonsi j.Tag 0 buttonsi j.Text quot quot buttonsi j.BackColor Button.DefaultBackColor Next Next SetBomb End Sub Public Function ClearOver As Integer Dim clear_bomb As Integer Dim clear_i clear_j As Integer clear_bomb 0 For clear_i 0 To 8 For clear_j 0 To 8 If buttonsclear_i clear_j.Tag gt 0 And buttonsclear_iclear_j.Tag lt 9 Then clear_bomb 1 End If Next Next If clear_bomb 0 Then For i 0 To 8 For j 0 To 8 buttonsi j.Enabled False buttonsi j.BackColor Button.DefaultBackColor If buttonsi j.Tag lt 0 Then buttonsi j.Text quot▲quot buttonsi j.BackColor Color.LightGreen End If Next Next MsgBoxquotUre winquot Me.Form1_Load End If Return 0 End Function Public Function SetBomb As Integer Dim k rand_i As Integer Dim temp_i temp_j As Integer rand_i 0 k 10 While k gt 0 Randomize rand_i RndNow.Second 80 If buttonsrand_i - 4 / 9 rand_i Mod 9.Tag 0 Then buttonsrand_i - 4 / 9 rand_i Mod 9.Tag -1 k - 1 End If buttonsrand_i - 4 / 9 rand_i Mod 9.Text quot quot End While For temp_i 0 To 8 For temp_j 0 To 8 If buttonstemp_i temp_j.Tag gt 0 And temp_i - 1 gt 0 And temp_j- 1 gt 0 Then If buttonstemp_i - 1 temp_j - 1.Tag lt 0 Then buttonstemp_i temp_j.Tag 1 End If End If If buttonstemp_i temp_j.Tag gt 0 And temp_i - 1 gt 0 And temp_j gt0 Then If buttonstemp_i - 1 temp_j.Tag lt 0 Then buttonstemp_i temp_j.Tag 1 End If End If If buttonstemp_i temp_j.Tag gt 0 And temp_i - 1 gt 0 And temp_j 1 lt 9 Then If buttonstemp_i - 1 temp_j 1.Tag lt 0 Then buttonstemp_i temp_j.Tag 1 End If End If If buttonstemp_i temp_j.Tag gt 0 And temp_i gt 0 And temp_j -1 gt 0 Then If buttonstemp_i temp_j - 1.Tag lt 0 Then buttonstemp_i temp_j.Tag 1 End If End If If buttons