【VB开源代码栏目提醒】:网学会员鉴于大家对VB开源代码十分关注,论文会员在此为大家搜集整理了“vb设计小游戏程序 - 编程语言”一文,供大家参考学习
添加一个名为 label1 的标签控件,并将其 index 设为 0;再添加一个名为command1 的按钮控件Dim a1 To 9 As BooleanDim win As Boolean begin As Boolean haveload As Boolean start AsBooleanPrivate Sub Command1_Clickstart True: begin FalseFor i 1 To 9 ai FalseNext iForm_LoadEnd SubPrivate Sub Form_Loada9 TrueLabel10.Visible FalseMe.Height 4400Me.Width 4000Scale 0 0-3 3.3If haveload False Then haveload True: start True Command1.Top 3: Command1.Left 2 Command1.Width 1: Command1.Height 0.3 Command1.Caption 开始 For i 1 To 9 Load Label1i Next iEnd IfFor i 1 To 9Label1i.Height 1Label1i.Width 1Label1i.Visible TrueLabel1i.Top i - 1 3Label1i.Left i - 1 Mod 3Label1i.Caption StriLabel1i.BackColor QBColoriLabel1i.FontBold TrueLabel1i.FontSize 40Next iLabel19.Caption : Label19.BackColor vbWhiteRandomizeFor i 1 To 500 r Int9 Rnd 1 Call Label1_ClickrNext ibegin TrueEnd SubPrivate Sub Label1_Clickindex As IntegerDim x1 As Integer y1 As IntegerIf start True Then If aindex False Then x1 index - 1 Mod 3: y1 index - 1 3 If x1 - 1 -0.2 Then If ax1 y1 3 True Then Call yidongx1 y1 3 index End If If x1 1 2.2 Then If ax1 y1 3 2 True Then Call yidongx1 y1 3 2 index End If If y1 - 1 -0.2 Then If ax1 1 y1 - 1 3 True Then Call yidongx1 y1 - 1 3 1index End If If y1 1 2.2 Then If ax1 1 y1 1 3 True Then Call yidongx1 1 y1 1 3 index End If End If win True For i 1 To 8 If ValLabel1i.Caption i Then win False Next i If win True And begin True Then MsgBox 恭喜你成功了: begin False: start FalseEnd IfEnd SubSub yidongx indexLabel10.Caption Label1index.Caption Label1index.Caption Label1x.Caption Label1x.Caption Label10.Caption aindex True: ax False Label10.BackColor Label1index.BackColor Label1index.BackColor Label1x.BackColor Label1x.BackColor Label10.BackColorEnd Sub上一篇:VB实验报告4