資源描述:
《Vb掃雷程序代碼》由會(huì)員上傳分享,免費(fèi)在線(xiàn)閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫(kù)。
1、PrivateobjMineAsNewclsWinMinePrivateSubForm_Load()SetobjMine.frmDisplay=MeEndSubPrivateSubForm_MouseDown(ButtonAsInteger,ShiftAsInteger,xAsSingle,yAsSingle)'判斷單擊的是哪個(gè)區(qū)域objMine.BeginHitTestButton,x,yEndSubPrivateSubForm_MouseMove(ButtonAsInteger,ShiftAsInteger,xAsSingle,yAsSingle)'判
2、斷當(dāng)鼠標(biāo)左鍵按下的時(shí)候鼠標(biāo)指針在哪個(gè)區(qū)域objMine.TrackHitTestButton,x,yEndSubPrivateSubForm_MouseUp(ButtonAsInteger,ShiftAsInteger,xAsSingle,yAsSingle)'判斷釋放鼠標(biāo)左鍵的時(shí)候鼠標(biāo)指針在哪個(gè)區(qū)域objMine.EndHitTestButton,x,yEndSubPrivateSubmnuBeginner_Click()mnuBeginner.Checked=TruemnuIntermediate.Checked=FalsemnuExpert.Chec
3、ked=FalsemnuCustom.Checked=False'初級(jí)模式objMine.SetMineFieldDimension8,8,10,FalseobjMine.mblnNewGame=TrueEndSubPrivateSubmnuCustom_Click()mnuBeginner.Checked=FalsemnuIntermediate.Checked=FalsemnuExpert.Checked=FalsemnuCustom.Checked=True'中級(jí)模式objMine.GetMineFieldDimensionsfrmCustomDlg
4、frmCustomDlg.Show1'如果按ESC鍵,則退出IffrmCustomDlg.mblnEscapeThenExitSubobjMine.SetMineFieldDimensionVal(frmCustomDlg.txtRows),Val(frmCustomDlg.txtColumns),Val(frmCustomDlg.txtMines),True'卸載隱藏的對(duì)話(huà)框UnloadfrmCustomDlg'做好準(zhǔn)備開(kāi)始新游戲objMine.mblnNewGame=TrueEndSubPrivateSubmnuExit_Click()'調(diào)用termi
5、nate事件SetobjMine=Nothing'退出游戲EndEndSubPrivateSubmnuExpert_Click()mnuBeginner.Checked=FalsemnuIntermediate.Checked=FalsemnuExpert.Checked=TruemnuCustom.Checked=False'高級(jí)模式objMine.SetMineFieldDimension16,30,100,FalseobjMine.mblnNewGame=TrueEndSubPrivateSubmnuIntermediate_Click()mnuBe
6、ginner.Checked=FalsemnuIntermediate.Checked=TruemnuExpert.Checked=FalsemnuCustom.Checked=False'自定義模式objMine.SetMineFieldDimension16,16,40,FalseobjMine.mblnNewGame=TrueEndSubPrivateSubmnuNew_Click()'開(kāi)始新游戲objMine.NewGameEndSubOptionExplicit'判斷左鍵是否按下PrivateConstLEFT_BUTTONAsByte=1'標(biāo)記
7、沒(méi)有地雷的區(qū)域PrivateConstNONEAsByte=0'標(biāo)記是否觸雷PrivateConstMINEAsByte=243'已經(jīng)清除地雷的區(qū)域PrivateConstBEENAsByte=244'標(biāo)記確定已經(jīng)有地雷的區(qū)域PrivateConstFLAGGEDAsByte=2'標(biāo)記可疑區(qū)域PrivateConstQUESTIONAsByte=1'最大、最小行列數(shù)PrivateConstMIN_MINESAsByte=10PrivateConstMAX_MINESAsByte=99PrivateConstMIN_ROWSAsInteger=8Privat
8、eConstMAX_ROWSAsInteger=24Private