学生、老师、公司、政府机关及行业资源交流与分享平台
上传文档赚钱 本站文档总量:6000+

打地鼠VB程序代码

  • 上传者:admin
  • 文件大小:12 (KB)
  • 文档格式:.docx

文档分类: 计算机软件及应用

要浏览文档,请确保Adobe Flash Player版本安装10.0.0或更高版本。

关于本文

  • 本文标题:打地鼠VB程序代码.docx
  • 链接地址:http://112job.cn/item/4861.html
  • 内容摘要:打地鼠VB程序代码打地鼠VB程序代码1PrivateCottotaltime=30PrivatesumAsLongntAsLongPrivateSubCommand1_Click()&#39结束按钮EndEndSubPrivateSubtimer1_timer()IfTimettotaltimeThenTimer1。Enabled=FalseMsgBox时间到!!!Text1。Text=您一共打中&sum&只地鼠,继续努力!EndIfDimiAsLongFori=0To8:Picture1(i)。Picture=LoadPicture:NextiRandomizei=Rnd8Picture1(i)。Picture=Image1。PictureEndSubPrivateSubpicture1_click(IndexAsInteger)IfNot(Picture1(Index)。PictureIsNothing)Theum=sum+1Label1。Caption=已经打中&sum&只地鼠!EndIfEndSub打地鼠VB程序代码2DimallnumAsIntegeroknumAsInteger&#39定义变化次数打中次数PrivateSuba_Click()Timer1。Interval=1000&#39新手EndSubPrivateSubb_Click()Timer1。Interval=700&#39达人EndSubPrivateSubc_Click()Timer1。Interval=500&#39老手EndSubPrivateSubCommand1_Click()IfCommand1。Caption=继续ThenTimer1。Enabled=TrueLabel2。Caption=运行中。。。ElseTimer1。Enabled=True&#39时间启动allnum=0&#39变化次数初始为0oknum=0&#39打中次数初始为0Label2。Caption=运行中。。。EndIfCommand1。Enabled=FalseCommand2。Enabled=TrueEndSubPrivateSubCommand2_Click()Timer1。Enabled=False&#39暂停Label2。Caption=暂停中。。。Command1。Caption=继续Command1。Enabled=TrueCommand2。Enabled=FalseEndSubPrivateSubCommand3_Click()UnloadMe&#39结束EndSubPrivateSubForm_Load()Timer1。Enabled=False&#39时间不启动allnum=0&#39变化次数初始为0oknum=0&#39打中次数初始为0EndSubPrivateSubPicture1_Click(IndexAsInteger)IfPicture1(Index)。Visible=TrueThenPicture1(Index)。picture=Src。Picture1。picture&#39击晕图显示oknum=oknum+1&#39打中次数+1EndIfEndSubPrivateSubtc_Click()UnloadMe&#39退出EndSubPrivateSubTimer1_Timer()Text1。Text=oknum&&allnum&#39打印得分allnum=allnum+1&#39变化次数值+1Fori=0To23Picture1(i)。Visible=False&#39地鼠消失NextRandomizePicture1(Int(Rnd()23))。Visible=True&#39随机函数控制地鼠图片显示EndSub打地鼠VB程序代码3Form1:PrivateSubForm_Load()DimtempAsIntegerRandomizetemp=Int(Rnd3)+1Form1。Picture=LoadPicture(C:\Use\Administrator\Desktop\打地鼠\picture&temp&。jpg)WindowsMediaPlayer1。URL=C:\Use\Administrator\Desktop\打地鼠\Heaven&#39sDevils。wmaEndSubPrivateSubLabel1_Click()Form2。ShowForm2。num=1Form1。HideWindowsMediaPlayer1。URL=OpenC:\Use\Administrator\Desktop\打地鼠\primary。datForAppendAs#1&#39写操作Close#1OpenC:\Use\Administrator\Desktop\打地鼠\intermediate。datForAppendAs#2Close#2OpenC:\Use\Administrator\Desktop\打地鼠\advanced。datForAppendAs#3Close#3EndSubPrivateSubLabel2_Click()EndEndSubForm2:DimallnumAsIntegeroknumAsInteger&#39定义变化次数打中次数PublicnumAsInteger&#39判别是否第一次开始游戏Dimflags1AsBoolean&#39判别文件是否保存PublicflagsAsBoolean&#39判别是否播放声音PrivateSubcountine_Click()pause。Enabled=TrueTimer1。Enabled=Truecountine。Enabled=FalseWLXZ。Enabled=TrueEndSubPrivateSubexit_Click()DimXAsIntegerDimttAsIntegerX=MsgBox(是否真的退出?vbYesNo退出游戏框)IfX=6Thentt=MsgBox(退出游戏之前是否保存vbYesNo保存提示)Iftt=6ThenIfflags1=TrueThenEndElseIfTimer1。Interval=1000ThenOpenC:\Use\Administrator\Desktop\打地鼠\primary。datForAppendAs#1&#39写操作Print#1Text1。Text++Format(DateMdyy)Close#1ElseIfTimer1。Interval=500ThenOpenC:\Use\Administrator\Desktop\打地鼠\intermediate。datForAppendAs#2Print#2Text1。Text++Format(DateMdyy)Close#2ElseOpenC:\Use\Administrator\Desktop\打地鼠\advanced。datForAppendAs#3Print#3Text1。Text++Format(DateMdyy)Close#3EndIfEndIfEndIfEndEndIfEndSubPrivateSubForm_Load()Form4。Check1。Value=1WindowsMediaPlayer1。Controls。stopcountine。Enabled=Falsepause。Enabled=FalseWLXZ。Enabled=FalseForm5。Top=Form2。Top+700Form5。Left=Form2。Leftflags1=Falseflags=TrueEndSubPrivateSubhelp_Click()Form3。ShowEndSubPrivateSubnew_game_Click()num=num+1DimtAsIntegerIf(num0)Thent=MsgBox(新游戏开始之前是否保存vbYesNo保存提示)Ift=6Thenflags1=TrueIfTimer1。Interval=1000ThenOpenC:\Use\Administrator\Desktop\打地鼠\primary。datForAppendAs#1&#39写操作Print#1Text1。Text++Format(DateMdyy)Close#1ElseIfTimer1。Interval=500ThenOpenC:\Use\Administrator\Desktop\打地鼠\intermediate。datForAppendAs#2Print#2Text1。Text++Format(DateMdyy)Close#2ElseOpenC:\Use\Administrator\Desktop\打地鼠\advanced。datForAppendAs#3Print#3Text1。Text++Format(DateMdyy)Close#3EndIfEndIfEndIfCallForm_Loadallnum=0&#39变化次数初始为0oknum=0&#39打中次数初始为0Timer1。Enabled=Truepause。Enabled=TrueWLXZ。Enabled=TrueEndSubPrivateSuboptio_Click()Timer1。Enabled=FalseForm4。ShowWLXZ。Enabled=Falsecountine。Enabled=TrueEndSubPrivateSubpause_Click()DimrgbAsIntegerTimer1。Enabled=Falsecountine。Enabled=Truepause。Enabled=FalseWLXZ。Enabled=FalseForm5。Top=Form2。Top+700Form5。Left=Form2。LeftForm5。Show
  • 版权声明:四方文库 所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。

copyright@ 2020-2028 四方文库版权所有
ICP备案号:湘ICP备16009149号-2