下载后可任意编辑VB 模拟扫雷游戏的尝试一、编程目的那天老师展示了一个不完全的扫雷,激发了编程欲望,于是写了扫雷来练练手。二、编程思路1、 新建 command_up 和 label_down,原来要用 text_down,但是后来在左右键同时按下的时候与 TextBox 的 enable 冲突,于是改成 label。2、 用 load 加载控件3、 根据雷区的 X、Y、以及难度进行随机布雷。4、 统计每一个 label 周围雷的数量并作为 label 的 caption。5、 在单击 command 的时候显示 label6、 在右击 command 的时候进行标记7、 在 label 上左右键同时按下的时候检查已标记雷的数量与 label 显示的数量是否一致。三、界面设计四、代码设计Dim Start_Time, End_TimeDim Area_X%, Area_Y%, Area%, Area_List()Dim Current_Mine%Dim Difficulty#Dim Continue_Flag%, Success_Flag%, LeftAndRight_Flag%下载后可任意编辑Dim Near_ListDim Mine_CountPrivate Sub Command_End_Click() EndEnd SubPrivate Sub Delete_Item(List(), Index As Integer) Dim i% For i = LBound(List) + Index - 1 To UBound(List) - 1 List(i) = List(i + 1) Next i '防止 100%的困难度 If UBound(List) > LBound(List) Then ReDim Preserve List(LBound(List) To UBound(List) - 1)End SubPrivate Sub Command_retry_Click() '卸载 For i = 1 To Area Unload Label_Down(i) Unload Command_Up(i) Next i Command_Start.Caption = "开始游戏" Call Command_Start_ClickEnd SubPrivate Sub Command_Up_Click(Index As Integer) Success_Flag = 1 If Continue_Flag = 1 Then If Timer1.Enabled = False Then Call Command_Start_Click If Label_Down(Index).Caption = "X" Then Success_Flag = 0 Continue_Flag = 0 For i = 1 To Area If Command_Up(i).Visible = True And Command_Up(i).Caption = "X" And Label_Down(i).BackColor = vbRed Then '标记雷正确 Command_Up(i).Picture = LoadPicture(App.Path + "\pictures\mine_correct.gif", , , Command_Up(i).Width, Command_Up(i).Height) Command_Up(i).Visible = True Label_Down(i).Visible = True ElseIf Command_Up(i).Visible = True And Command_Up(i).Captio...