首页 VB制作拼图游戏

VB制作拼图游戏

举报
开通vip

VB制作拼图游戏《VB制作拼图游戏:简单算法》 1、首先按照截图把控件添加好! (技巧:PS处理322*322的图片,划分切块,形成九个小图片,这里采用的是Jpg格式,然后采用Command按钮来显示这些图片,同学们也可以采用Label,是一样的,重点是鼠标单击事件!注意:添加九个Command按钮,一定要设置每个按钮的Height、Width、Top、Left值来完成对图片的吻合拼接,这样可以使界面看起来美观大方!) 2、界面的设计 这里很多同学习惯更改Command的Caption值来显示某些文本,但要注意,你这里很可能为...

VB制作拼图游戏
《VB制作拼图游戏:简单算法》 1、首先按照截图把控件添加好! (技巧:PS处理322*322的图片,划分切块,形成九个小图片,这里采用的是Jpg 格式 pdf格式笔记格式下载页码格式下载公文格式下载简报格式下载 ,然后采用Command按钮来显示这些图片,同学们也可以采用Label,是一样的,重点是鼠标单击事件!注意:添加九个Command按钮,一定要设置每个按钮的Height、Width、Top、Left值来完成对图片的吻合拼接,这样可以使界面看起来美观大方!) 2、界面的设计 这里很多同学习惯更改Command的Caption值来显示某些文本,但要注意,你这里很可能为了美观会使用自己机子上单独安装的某些字体,这些字体拿到其他机子上是不生效的,那么怎么办呢?这里有个比较“笨拙的方法”——你可以利用Word工具打好想要显示的文本,设置个性字体,然后截图,插入到Command上面,这样的话,无论是什么字体,都可以显示了,因为图片的属性是无法更改的!这个方法同样可以用来美化Label!当然了,自己究竟怎么样设计,就靠想象力了,最终得到的效果是要有一个美观、简洁大方的界面! 3、算法设计(全部代码) Dim Num As Integer Private Sub Command1_Click() If Command2.Picture = Command11.Picture Then Command2.Picture = Command1.Picture Command1.Picture = Command11.Picture End If If Command4.Picture = Command11.Picture Then Command4.Picture = Command1.Picture Command1.Picture = Command11.Picture End If End Sub Private Sub Command11_Click() MsgBox ("开发者:孔世明" & vbCrLf & "学院:信息科学与技术学院" & vbCrLf & "专业:软件工程" & vbCrLf & "班级:软件一班" & vbCrLf & "学号:201213040117") End Sub Private Sub Command12_Click() Num = Num + 1 If Num = 1 Then Command9.Picture = Command11.Picture End If If Num = 2 Then MsgBox ("亲~~不能重复开始哦!~") End If If Num = 3 Then MsgBox ("亲~~再说一次,不能重复开始!!") End If If Num > 3 Then MsgBox ("请不要放弃治疗!!!") End If End Sub Private Sub Command2_Click() If Command1.Picture = Command11.Picture Then Command1.Picture = Command2.Picture Command2.Picture = Command11.Picture End If If Command3.Picture = Command11.Picture Then Command3.Picture = Command2.Picture Command2.Picture = Command11.Picture End If If Command5.Picture = Command11.Picture Then Command5.Picture = Command2.Picture Command2.Picture = Command11.Picture End If End Sub Private Sub Command3_Click() If Command2.Picture = Command11.Picture Then Command2.Picture = Command3.Picture Command3.Picture = Command11.Picture End If If Command6.Picture = Command11.Picture Then Command6.Picture = Command3.Picture Command3.Picture = Command11.Picture End If End Sub Private Sub Command4_Click() If Command1.Picture = Command11.Picture Then Command1.Picture = Command4.Picture Command4.Picture = Command11.Picture End If If Command5.Picture = Command11.Picture Then Command5.Picture = Command4.Picture Command4.Picture = Command11.Picture End If If Command7.Picture = Command11.Picture Then Command7.Picture = Command4.Picture Command4.Picture = Command11.Picture End If End Sub Private Sub Command5_Click() If Command2.Picture = Command11.Picture Then Command2.Picture = Command5.Picture Command5.Picture = Command11.Picture End If If Command4.Picture = Command11.Picture Then Command4.Picture = Command5.Picture Command5.Picture = Command11.Picture End If If Command6.Picture = Command11.Picture Then Command6.Picture = Command5.Picture Command5.Picture = Command11.Picture End If If Command8.Picture = Command11.Picture Then Command8.Picture = Command5.Picture Command5.Picture = Command11.Picture End If End Sub Private Sub Command6_Click() If Command3.Picture = Command11.Picture Then Command3.Picture = Command6.Picture Command6.Picture = Command11.Picture End If If Command5.Picture = Command11.Picture Then Command5.Picture = Command6.Picture Command6.Picture = Command11.Picture End If If Command9.Picture = Command11.Picture Then Command9.Picture = Command6.Picture Command6.Picture = Command11.Picture End If End Sub Private Sub Command7_Click() If Command4.Picture = Command11.Picture Then Command4.Picture = Command7.Picture Command7.Picture = Command11.Picture End If If Command8.Picture = Command11.Picture Then Command8.Picture = Command7.Picture Command7.Picture = Command11.Picture End If End Sub Private Sub Command8_Click() If Command5.Picture = Command11.Picture Then Command5.Picture = Command8.Picture Command8.Picture = Command11.Picture End If If Command7.Picture = Command11.Picture Then Command7.Picture = Command8.Picture Command8.Picture = Command11.Picture End If If Command9.Picture = Command11.Picture Then Command9.Picture = Command8.Picture Command8.Picture = Command11.Picture End If End Sub Private Sub Command9_Click() If Command6.Picture = Command11.Picture Then Command6.Picture = Command9.Picture Command9.Picture = Command11.Picture End If If Command8.Picture = Command11.Picture Then Command8.Picture = Command9.Picture Command9.Picture = Command11.Picture End If End Sub 【应该看得出来,这里的算法只有一个:判断某个按钮相邻的Command显示图片是否为“空白”,若是,则交换图片显示,但要注意,这里还要引入第三个Command当做“中转站”,这其实和C++里面交换某两个变量的值是一个道理,如果没有这个媒介,那么图片交换两次,最终会没有变化。】
本文档为【VB制作拼图游戏】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_682974
暂无简介~
格式:doc
大小:26KB
软件:Word
页数:0
分类:理学
上传时间:2019-08-05
浏览量:4