表白程序VB源码.docx
《表白程序VB源码.docx》由会员分享,可在线阅读,更多相关《表白程序VB源码.docx(19页珍藏版)》请在冰豆网上搜索。
表白程序VB源码
PrivateDeclareFunctionmciSendStringLib"winmm.dll"Alias"mciSendStringA"AsLong'mcisendstring播放音乐的API函数
PrivateDeclareFunctiontimeGetTimeLib"winmm.dll"<>AsLong'用于制作延时函数
DimWithEventsimgMGAsImage'申明控件数组
DimiAsInteger'全局变量
DimimgBox<999>AsImage'记录控件数组的数组
DimratioAsDouble
PrivateSubForm_Load<>
Me.Show
Me.BorderStyle=0
Me.WindowState=2
Picture1.Top=0
Picture1.Left=0
Picture1.Width=20480'图片框宽度等于屏幕宽度
Picture1.Height=11510'
ratio=Picture1.Width/Picture1.Height
Picture1.Scale<-ratio/2,1>-
Picture1.BackColor=vbWhite
DrawLines0,0
Image1<0>.Picture=LoadPicture
Label1.Top=0
Label1.Left=0
Label1.FontBold=True
Label1.ForeColor=vbRed
Label1.Caption=""
Label2.Visible=False
'CallBB
EndSub
PrivateSubLabel2_Click<>
mciSendString"closemovie",0&,0,0
UnloadMe'退出程序
EndSub
PrivateSubBB<>'本程序主要的函数,功能都在里实现
CallMusicPlay'播放音乐
Forj=1To99
X=Rnd*20480
Y=Rnd*11510
i=i+1
LoadImage1
Image1.Picture=Image1<0>.Picture
Image1.Width=Image1<0>.Width
Image1.Height=Image1<0>.Height
Image1.Top=Y
Image1.Left=X
Image1.Visible=True
Sleep2200
Label1.Caption=i&"送上99朵玫瑰,代表我的心!
"
Nextj
Label1.Caption="我们一起长长久久"'随机"画〞出99朵玫瑰
nullMeiGuii'"察〞去玫瑰清屏,下同
Label1.Caption=""
MeiGui"TX.tat"
Label1.Caption="你和你的名字在我心中"
Sleep23000
nullMeiGuii'画出桃心
Label1.Caption=""
MeiGui"ILU.tat"
Label1.Caption="ILOVEU"
Sleep23000
nullMeiGuii'画出iloveu
Label1.Caption=""
MeiGui"XHM.tat"
Label1.Caption="喜欢吗?
"
Y=MsgBox<"告诉我你喜欢吗?
",vbYesNo,"我想知道">
IfY=vbYesThen
nullMeiGuii
MeiGui"XL.tat"
Label1.Caption="你喜欢,我很开心"
OpenApp.Path&"\DA.tat"ForAppendAs#1
Print#1,"我喜欢"
Close#1
Else
nullMeiGuii
MeiGui"KL.tat"
Label1.Caption="你不喜欢,我很难过"
OpenApp.Path&"\DA.tat"ForAppendAs#1
Print#1,"我不喜欢"
Close#1
EndIf
Label2.Visible=True
Label2.ForeColor=vbRed
Label2.Caption="点这里退出"
Label2.Top=Picture1.Height-Label2.Height
Label2.Left=Picture1.Width/2-Label2.Width/2
EndSub
PrivateSubMusicPlay<>'音乐播放函数
mName=App.Path&"\DDN.mp3"'获取音乐文件地址与文件名,音乐文件放在当前文件夹下,App.Path即为我去程序所在当前文件夹路径
mciSendString"closemovie",0&,0,0
mciSendString"open"&mName&"TYPEMPEGVideoAliasmovie",0&,0,0'注意open后有个空格,TYPE前有个空格,否则播放不成功
mciSendString"playmovierepeat",0&,0,0
mciSendString"playmovie",0&,0,0
EndSub
PrivateSubMeiGui'用玫瑰绘制想要写的字或图片,文件是事先做好的,可以通过代码下面的代码完成
OpenApp.Path&"\"&strFileForInputAs#1
WhileNotEOF<1>
Sleep2<200>
Input#1,X,Y
i=i+1
LoadImage1
Image1.Picture=Image1<0>.Picture
Image1.Width=Image1<0>.Width
Image1.Height=Image1<0>.Height
Image1.Top=Y-Image1<0>.Height/2
Image1.Left=X-Image1<0>.Width/2
Image1.Visible=True
Wend
Close#1
EndSub
PrivateSubnullMeiGui'通过释放控件数组清屏
Forj=NTo1Step-1
Sleep2<200>
UnloadImage1
Nextj
i=0
EndSub
PrivateFunctionSleep2'延时函数
DimSavetimeAsLong
Savetime=timeGetTime'记下开始时的时间,以毫秒为单位
WhiletimeGetTimeDoEvents'转让控制权
Wend
EndFunction
PrivateSubPicture1_MouseDown'用点描记出要绘制的图画或文字,记录的数据保存在c_drawable.tat,复制出去可用
Picture1.FillStyle=0
Picture1.FillColor=vbRed
Picture1.Circle,0.01,vbRed
OpenApp.Path&"\c_drawable.tat"ForAppendAs#1
Print#1,X&"f,","0.0f,",Y&"f,";记录点击的位置
Close#1
EndSub
PrivateSubDrawLines'画网格,描记图形时用
Picture1.FillStyle=0
Picture1.FillColor=vbRed
Picture1.Line<0,1>-<0,-1>
Picture1.Line<-ratio/2,0>-
EndSub
程序中用到的图片资源:
红玫瑰.gif
ILU.tat文件记录的数据
15752295
15303450
15754590
15155775
14856885
14708025
38852310
38553465
39004590
38405760
38406900
37657995
45608040
56107995
70653045
60154065
58655340
60156420
66757320
71407590
77557080
81606165
81604995
76653840
85352850
88053765
90904980
93155985
95556870
100507485
107556660
112205595
114304515
116853525
118502730
125252685
131702685
142052685
124053735
124204875
124505820
124206780
123907545
134107500
144757590
131255040
139354995
160802685
160653810
162155010
165606090
171457200
179707260
184806345
186605175
189003930
189303195
190052625
其他文件数据附于文末
运行时截图:
程序运行是动态的,这是瞬间截图
TX.tat数据
88353300
81602895
71402490
61952610
56553315
55054305
56855460
61206465
69457380
76808145
84608625
92708910
100658580
109358040
115207410
121356525
126155595
129604425
130203540
128852685
123452130
116552115
108002370
99602745
94353030
76052640
65552520
58202955
55653795
55654935
58956030
64656840
72907755
80708355
88958730
97208685
105008235
112057680
117756855
123306015
128405025
85804650
77254140
75155265
69904545
69753825
62404260
65553300
72303210
80103510
85503900
81005625
79654770
69305130
62554905
63005400
66156015
70805670
72456585
76056030
68856345
76657140
81757800
75307620
82206570
83857290
89256735
89257380
88057890
85808250
90458295
95557815
96908265
102757860
99457485
94807185
106657125
107407500
112357080
100356990
95856495
88806150
84755955
85955250
90755235
90305535
97655865
97055400
97054785
90754530
90753930
95403975
96003450
101253180
101253840
102454365
97654275
107403225
107402790
114002820
118502670
122402805
120153285
112953270
113703810
108303840
107104290
112954230
120004170
118653735
123753705
124803210
101704965
103655460
113555520
111455175
109505655
105006000
100506120
103206570
108456300
111906690
108006645
116106390
112506090
107254875
115204770
112504665
124354155
128853960
123304770
120004650
118955130
124505265
119705490
117005730
118056030
121955685
XHM.tat数据
14852265
23252310
32102295
41402340
52202340
32401410
31502895
30753585
21003045
42153120
16354050
27154110
40804215
18304680
27904755
37354710
38705520
17105385
16956015
25956135
38106240
19206870
33906945
4507800
15157785
27457800
39607800
52957770
13058475
20708505
32708520
33159390
11559180
11709840
21759900
336010020
64053615
72903645
84003615
81004335
71555325
65706285
61656795
67804590
77406135
93753000
89854035
86854830
97504005
107703990
115803990
124353915
120454725
102004485
97505295
92706015
88056780
82957440
102305895
106956540
111607230
138452655
138453480
138454335
147452640
154652595
155253540
154954335
146254320
164102565
172502625
181052535
186302520
183603630
179254590
176105205
169503480
166354410
160955325
154956045
168006015
179105955
188255895
187656765
184357680
183008415
181059120
174308595
137107335
151957290
164407275
172507230
XL.tat数据
55052985
69002340
90002055
111002310
120003630
122705835
49054800
51456495
64657635
76508475
97658280
115057320
59854080
68103855
76953960
78604410
90304470
94354125
102603885
108454155
112504770
67206210
72606675
80707005
90456885
96006390
100206090
122404785
115652865
99902040
77252115
61652595
51153870
49055580
57607080
69458055
85958430
106057755
120306525
将上述文件数据复制到文本文件中,后缀名改为tat