资源描述:
《Vb扫雷程序代码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、PrivateobjMineAsNewclsWinMinePrivateSubForm_Load()SetobjMine.frmDisplay=MeEndSubPrivateSubForm_MouseDown(ButtonAsInteger,ShiftAsInteger,xAsSingle,yAsSingle)'判断单击的是哪个区域objMine.BeginHitTestButton,x,yEndSubPrivateSubForm_MouseMove(ButtonAsInteger,ShiftAsInteger,xAsSingle,yAsSingle)'判
2、断当鼠标左键按下的时候鼠标指针在哪个区域objMine.TrackHitTestButton,x,yEndSubPrivateSubForm_MouseUp(ButtonAsInteger,ShiftAsInteger,xAsSingle,yAsSingle)'判断释放鼠标左键的时候鼠标指针在哪个区域objMine.EndHitTestButton,x,yEndSubPrivateSubmnuBeginner_Click()mnuBeginner.Checked=TruemnuIntermediate.Checked=FalsemnuExpert.Chec
3、ked=FalsemnuCustom.Checked=False'初级模式objMine.SetMineFieldDimension8,8,10,FalseobjMine.mblnNewGame=TrueEndSubPrivateSubmnuCustom_Click()mnuBeginner.Checked=FalsemnuIntermediate.Checked=FalsemnuExpert.Checked=FalsemnuCustom.Checked=True'中级模式objMine.GetMineFieldDimensionsfrmCustomDlg
4、frmCustomDlg.Show1'如果按ESC键,则退出IffrmCustomDlg.mblnEscapeThenExitSubobjMine.SetMineFieldDimensionVal(frmCustomDlg.txtRows),Val(frmCustomDlg.txtColumns),Val(frmCustomDlg.txtMines),True'卸载隐藏的对话框UnloadfrmCustomDlg'做好准备开始新游戏objMine.mblnNewGame=TrueEndSubPrivateSubmnuExit_Click()'调用termi
5、nate事件SetobjMine=Nothing'退出游戏EndEndSubPrivateSubmnuExpert_Click()mnuBeginner.Checked=FalsemnuIntermediate.Checked=FalsemnuExpert.Checked=TruemnuCustom.Checked=False'高级模式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()'开始新游戏objMine.NewGameEndSubOptionExplicit'判断左键是否按下PrivateConstLEFT_BUTTONAsByte=1'标记
7、没有地雷的区域PrivateConstNONEAsByte=0'标记是否触雷PrivateConstMINEAsByte=243'已经清除地雷的区域PrivateConstBEENAsByte=244'标记确定已经有地雷的区域PrivateConstFLAGGEDAsByte=2'标记可疑区域PrivateConstQUESTIONAsByte=1'最大、最小行列数PrivateConstMIN_MINESAsByte=10PrivateConstMAX_MINESAsByte=99PrivateConstMIN_ROWSAsInteger=8Privat
8、eConstMAX_ROWSAsInteger=24Private