


下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、vb编程设计扫雷实验报告一 设计名称:扫雷二 设计目的:通过vb程序设计出类似游戏“扫雷”的程序。三 vb设计扫雷游戏界面:四设计步骤:1. 新建一个工程2. 设置控件添加command1控件数组,控件数组内个数为99。添加command2控件,caption属性设置为“开始”添加timer控件,设置interval属性值为“1000”添加label1,label2控件,设置caption属性分别为“雷数”,“计时”添加text1,text2控件,设置text属性为“20”3. 编写代码3private sub command1_mousedown(index as integer, butt
2、on as integer, shift as integer, x as single, y as single)if button = 1 then if command1(index).tag = true then msgbox gameover! timer1.enabled = false text2 = 0 else m = 0 select case index case 0 if command1(index + 1).tag = true then m = m + 1 if command1(index + 10).tag = true then m = m + 1 if
3、command1(index + 11).tag = true then m = m + 1 case 9 if command1(index - 1).tag = true then m = m + 1 if command1(index + 10).tag = true then m = m + 1 if command1(index + 9).tag = true then m = m + 1 case 90 if command1(index + 1).tag = true then m = m + 1 if command1(index - 10).tag = true then m
4、 = m + 1 if command1(index - 9).tag = true then m = m + 1 case 99 if command1(index - 1).tag = true then m = m + 1 if command1(index - 10).tag = true then m = m + 1 if command1(index - 11).tag = true then m = m + 1 case 1 to 8 if command1(index + 1).tag = true then m = m + 1 if command1(index - 1).t
5、ag = true then m = m + 1 if command1(index + 10).tag = true then m = m + 1 if command1(index + 9).tag = true then m = m + 1 if command1(index + 11).tag = true then m = m + 1 case 91 to 98 if command1(index + 1).tag = true then m = m + 1 if command1(index - 1).tag = true then m = m + 1 if command1(in
6、dex - 10).tag = true then m = m + 1 if command1(index - 9).tag = true then m = m + 1 if command1(index - 11).tag = true then m = m + 1 case 10, 20, 30, 40, 50, 60, 70, 80 if command1(index + 10).tag = true then m = m + 1 if command1(index - 10).tag = true then m = m + 1 if command1(index + 1).tag =
7、true then m = m + 1 if command1(index - 9).tag = true then m = m + 1 if command1(index + 11).tag = true then m = m + 1 case 19, 29, 39, 49, 59, 69, 79, 89 if command1(index + 10).tag = true then m = m + 1 if command1(index - 10).tag = true then m = m + 1 if command1(index - 1).tag = true then m = m
8、+ 1 if command1(index + 9).tag = true then m = m + 1 if command1(index - 11).tag = true then m = m + 1 case else if command1(index + 10).tag = true then m = m + 1 if command1(index - 10).tag = true then m = m + 1 if command1(index + 1).tag = true then m = m + 1 if command1(index + 9).tag = true then
9、 m = m + 1 if command1(index + 11).tag = true then m = m + 1 if command1(index - 1).tag = true then m = m + 1 if command1(index - 9).tag = true then m = m + 1 if command1(index - 11).tag = true then m = m + 1 end select command1(index).caption = m end ifend ifif button = 2 then if command1(index).ta
10、g = true then command1(index).caption = * text1 = val(text1) - 1 else command1(index).caption = ? end ifend ifend subprivate sub command2_click()timer1.enabled = truetext2 = 0randomizefor i = 0 to 99command1(i).tag = falsecommand1(i).caption = nextfor i = 1 to val(text1)k = int(rnd * 100)if command1(k).tag = true theni = i - 1elsecommand1(k).tag = trueend if
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 淡水彩古典花纹毕业答辩设计
- 礼仪教育之德育主题班会
- CPA税法基础知识课件
- BIM基础知识课件
- 吉林职业技术学院《生物化学与分子生物化学A》2023-2024学年第二学期期末试卷
- 曲靖市富源县2024-2025学年三年级数学第二学期期末复习检测模拟试题含解析
- 2025年湖南长郡教育集团重点中学初三一模化学试题试卷含解析
- 辽宁铁道职业技术学院《现代交换原理》2023-2024学年第二学期期末试卷
- 天津理工大学中环信息学院《专业综合技能培训》2023-2024学年第二学期期末试卷
- 湖南交通工程学院《设计与市场》2023-2024学年第一学期期末试卷
- 2024-2025年人教版七下语文期中复习-专题01 基础知识积累(考点串讲)
- 2025重庆西南证券股份有限公司招聘45人笔试参考题库附带答案详解
- 湖南省示范性高中2024-2025学年高二下学期2月联考 物理试卷(含解析)
- 2025年《宏观经济政策与发展规划》考前通关必练题库(含答案)
- 服装公司品质(质量)管理手册
- 一年级道德与法治下册素养教案第10课 相亲相爱一家人
- 办公楼弱电系统设计方案
- 私募投资学试题及答案
- 2025年合肥二模数学试题及答案
- 不要慌太阳下山有月光二部合唱简谱
- 干净整洁的个人卫生习惯
评论
0/150
提交评论