表白程序-VB源码

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

PrivateDeclareFunctionmciSendStringLibwinmm.dllAliasmciSendStringA(ByVallpstrCommandAsString,ByVallpstrReturnStringAsString,ByValuReturnLengthAsLong,ByValhwndCallbackAsLong)AsLong'mcisendstring播放音乐的API函数PrivateDeclareFunctiontimeGetTimeLibwinmm.dll()AsLong'用于制作延时函数DimWithEventsimgMGAsImage'申明控件数组DimiAsInteger'全局变量DimimgBox(999)AsImage'记录控件数组的数组DimratioAsDoublePrivateSubForm_Load()Me.ShowMe.BorderStyle=0Me.WindowState=2Picture1.Top=0Picture1.Left=0Picture1.Width=20480'图片框宽度等于屏幕宽度Picture1.Height=11510'ratio=Picture1.Width/Picture1.HeightPicture1.Scale(-ratio/2,1)-(ratio/2,-1)Picture1.BackColor=vbWhiteDrawLines0,0Image1(0).Picture=LoadPicture(App.Path&\红玫瑰.gif)Label1.Top=0Label1.Left=0Label1.FontBold=TrueLabel1.ForeColor=vbRedLabel1.Caption=Label2.Visible=False'CallBBEndSubPrivateSubLabel2_Click()mciSendStringclosemovie,0&,0,0UnloadMe'退出程序EndSubPrivateSubBB()'本程序主要的函数,功能都在里实现CallMusicPlay'播放音乐Forj=1To99X=Rnd*20480Y=Rnd*11510i=i+1LoadImage1(i)Image1(i).Picture=Image1(0).PictureImage1(i).Width=Image1(0).WidthImage1(i).Height=Image1(0).HeightImage1(i).Top=YImage1(i).Left=XImage1(i).Visible=TrueSleep2200Label1.Caption=i&送上99朵玫瑰,代表我的心!NextjLabel1.Caption=我们一起长长久久'随机“画”出99朵玫瑰nullMeiGuii'“察”去玫瑰清屏,下同Label1.Caption=MeiGuiTX.tatLabel1.Caption=你和你的名字在我心中Sleep23000nullMeiGuii'画出桃心Label1.Caption=MeiGuiILU.tatLabel1.Caption=ILOVEUSleep23000nullMeiGuii'画出iloveuLabel1.Caption=MeiGuiXHM.tatLabel1.Caption=喜欢吗?Y=MsgBox(告诉我你喜欢吗?,vbYesNo,我想知道)IfY=vbYesThennullMeiGuiiMeiGuiXL.tatLabel1.Caption=你喜欢,我很开心OpenApp.Path&\DA.tatForAppendAs#1Print#1,我喜欢Close#1ElsenullMeiGuiiMeiGuiKL.tatLabel1.Caption=你不喜欢,我很难过OpenApp.Path&\DA.tatForAppendAs#1Print#1,我不喜欢Close#1EndIfLabel2.Visible=TrueLabel2.ForeColor=vbRedLabel2.Caption=点这里退出Label2.Top=Picture1.Height-Label2.HeightLabel2.Left=Picture1.Width/2-Label2.Width/2EndSubPrivateSubMusicPlay()'音乐播放函数mName=App.Path&\DDN.mp3'获取音乐文件地址及文件名,音乐文件放在当前文件夹下,App.Path即为我去程序所在当前文件夹路径mciSendStringclosemovie,0&,0,0mciSendStringopen&mName&TYPEMPEGVideoAliasmovie,0&,0,0'注意open后有个空格,TYPE前有个空格,否则播放不成功mciSendStringplaymovierepeat,0&,0,0mciSendStringplaymovie,0&,0,0EndSubPrivateSubMeiGui(ByValstrFileAsString)'用玫瑰绘制想要写的字或图片,文件是事先做好的,可以通过代码下面的代码完成OpenApp.Path&\&strFileForInputAs#1WhileNotEOF(1)Sleep2(200)Input#1,X,Yi=i+1LoadImage1(i)Image1(i).Picture=Image1(0).PictureImage1(i).Width=Image1(0).WidthImage1(i).Height=Image1(0).HeightImage1(i).Top=Y-Image1(0).Height/2Image1(i).Left=X-Image1(0).Width/2Image1(i).Visible=TrueWendClose#1EndSubPrivateSubnullMeiGui(ByValNAsInteger)'通过释放控件数组清屏Forj=NTo1Step-1Sleep2(200)UnloadImage1(j)Nextji=0EndSubPrivateFunctionSleep2(TAsLong)'延时函数DimSavetimeAsLongSavetime=timeGetTime'记下开始时的时间,以毫秒为单位WhiletimeGetTimeSavetime+T'循环等待DoEvents'转让控制权WendEndFunctionPrivateSubPicture1_MouseDown(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)'用点描记出要绘制的图画或文字,记录的数据保存在c_drawable.tat,复制出去可用Picture1.FillStyle=0Picture1.FillColor=vbRedPicture1.Circle(X,Y),0.01,vbRedOpenApp.Path&\c_drawable.tatForAppendAs#1Print#1,X&f,,0.0f,,Y&f,;记录点击的位置Close#1EndSubPrivateSubDrawLines(ByValXAsLong,ByValYAsLong)'画网格,描记图形时用Picture1.FillStyle=0Picture1.FillColor=vbRedPicture1.Line(0,1)-(0,-1)Picture1.Line(-ratio/2,0)-(ratio/2,0)EndSub程序中用到的图片资源:红玫瑰.gifILU.tat文件记录的数据1575229515303450157545901515577514856885147080253885231038553465390045903840576038406900376579954560804056107995706530456015406558655340601564206675732071407590775570808160616581604995766538408535285088053765909049809315598595556870100507485107556660112205595114304515116853525118502730125252685131702685142052685124053735124204875124505820124206780123907545134107500144757590131255040139354995160802685160653810162155010165606090171457200179707260184806345186605175189003930189303195190052625其他文件数据附于文末运行时截图:程序运行是动态的,这是瞬间截图TX.tat数据88353300816028957140249061952610565533155505430556855460612064656945738076808145846086259270891010065858010935804011520741012135652512615559512960442513020354012885268512345213011655211510800237099602745943530307605264065552520582029555565379555654935589560306465684072907755807083558895873097208685105008235112057680117756855123306015128405025858046507725414075155265699045456975382562404260655533007230321080103510855039008100562579654770693051306255490563005400661560157080567072456585760560306885634576657140817578007530762082206570838572908925673589257380880578908580825090458295955578159690826510275786099457485948071851066571251074075001123570801003569909585649588806150847559558595525090755235903055359765586597055400970547859075453090753930954039759600345010125318010125384010245436597654275107403225107402790114002820118502670122402805120153285112953270113703810108303840107104290112954230120004170118653735123753705124803210101704965103655460113555520111455175109505655105006000100506120103206570108456300111906690108006645116106390112506090107254875115204770112504665124354155128853960123304770120004650118955130124505265119705490117005730118056030121955685XHM.tat数据148522652325231032102295414023405220234032401410315028953075358521003045421531201635405

1 / 13
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功