表白程序VB源碼.doc
《表白程序VB源碼.doc》由會(huì)員分享,可在線閱讀,更多相關(guān)《表白程序VB源碼.doc(13頁珍藏版)》請?jiān)谘b配圖網(wǎng)上搜索。
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long mcisendstring播放音樂的API函數(shù) Private Declare Function timeGetTime Lib "winmm.dll" () As Long 用于制作延時(shí)函數(shù) Dim WithEvents imgMG As Image 申明控件數(shù)組 Dim i As Integer 全局變量 Dim imgBox(999) As Image 記錄控件數(shù)組的數(shù)組 Dim ratio As Double Private Sub Form_Load() Me.Show Me.BorderStyle = 0 Me.WindowState = 2 Picture1.Top = 0 Picture1.Left = 0 Picture1.Width = 20480 圖片框?qū)挾鹊扔谄聊粚挾? Picture1.Height = 11510 ratio = Picture1.Width / Picture1.Height Picture1.Scale (-ratio / 2, 1)-(ratio / 2, -1) Picture1.BackColor = vbWhite DrawLines 0, 0 Image1(0).Picture = LoadPicture(App.Path & "\紅玫瑰.gif") Label1.Top = 0 Label1.Left = 0 Label1.FontBold = True Label1.ForeColor = vbRed Label1.Caption = "" Label2.Visible = False Call BB End Sub Private Sub Label2_Click() mciSendString "close movie", 0&, 0, 0 Unload Me 退出程序 End Sub Private Sub BB() 本程序主要的函數(shù),功能都在里實(shí)現(xiàn) Call MusicPlay 播放音樂 For j = 1 To 99 X = Rnd * 20480 Y = Rnd * 11510 i = i + 1 Load Image1(i) Image1(i).Picture = Image1(0).Picture Image1(i).Width = Image1(0).Width Image1(i).Height = Image1(0).Height Image1(i).Top = Y Image1(i).Left = X Image1(i).Visible = True Sleep2 200 Label1.Caption = i & "送上99朵玫瑰,代表我的心!" Next j Label1.Caption = "我們一起長長久久" 隨機(jī)“畫”出99朵玫瑰 nullMeiGui i “察”去玫瑰清屏,下同 Label1.Caption = "" MeiGui "TX.tat" Label1.Caption = "你和你的名字在我心中" Sleep2 3000 nullMeiGui i 畫出桃心 Label1.Caption = "" MeiGui "ILU.tat" Label1.Caption = "I LOVE U" Sleep2 3000 nullMeiGui i 畫出i love u Label1.Caption = "" MeiGui "XHM.tat" Label1.Caption = "喜歡嗎?" Y = MsgBox("告訴我你喜歡嗎?", vbYesNo, "我想知道") If Y = vbYes Then nullMeiGui i MeiGui "XL.tat" Label1.Caption = "你喜歡,我很開心" Open App.Path & "\DA.tat" For Append As #1 Print #1, "我喜歡" Close #1 Else nullMeiGui i MeiGui "KL.tat" Label1.Caption = "你不喜歡,我很難過" Open App.Path & "\DA.tat" For Append As #1 Print #1, "我不喜歡" Close #1 End If Label2.Visible = True Label2.ForeColor = vbRed Label2.Caption = "點(diǎn)這里退出" Label2.Top = Picture1.Height - Label2.Height Label2.Left = Picture1.Width / 2 - Label2.Width / 2 End Sub Private Sub MusicPlay() 音樂播放函數(shù) mName = App.Path & "\DDN.mp3" 獲取音樂文件地址及文件名,音樂文件放在當(dāng)前文件夾下,App.Path即為我去程序所在當(dāng)前文件夾路徑 mciSendString "close movie", 0&, 0, 0 mciSendString "open " & mName & " TYPE MPEGVideo Alias movie", 0&, 0, 0 注意open后有個(gè)空格,TYPE前有個(gè)空格,否則播放不成功 mciSendString "play movie repeat", 0&, 0, 0 mciSendString "play movie", 0&, 0, 0 End Sub Private Sub MeiGui(ByVal strFile As String) 用玫瑰繪制想要寫的字或圖片,文件是事先做好的,可以通過代碼下面的代碼完成 Open App.Path & "\" & strFile For Input As #1 While Not EOF(1) Sleep2 (200) Input #1, X, Y i = i + 1 Load Image1(i) Image1(i).Picture = Image1(0).Picture Image1(i).Width = Image1(0).Width Image1(i).Height = Image1(0).Height Image1(i).Top = Y - Image1(0).Height / 2 Image1(i).Left = X - Image1(0).Width / 2 Image1(i).Visible = True Wend Close #1 End Sub Private Sub nullMeiGui(ByVal N As Integer) 通過釋放控件數(shù)組清屏 For j = N To 1 Step -1 Sleep2 (200) Unload Image1(j) Next j i = 0 End Sub Private Function Sleep2(T As Long) 延時(shí)函數(shù) Dim Savetime As Long Savetime = timeGetTime 記下開始時(shí)的時(shí)間,以毫秒為單位 While timeGetTime < Savetime + T 循環(huán)等待 DoEvents 轉(zhuǎn)讓控制權(quán) Wend End Function Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) 用點(diǎn)描記出要繪制的圖畫或文字,記錄的數(shù)據(jù)保存在c_drawable.tat,復(fù)制出去可用 Picture1.FillStyle = 0 Picture1.FillColor = vbRed Picture1.Circle (X, Y), 0.01, vbRed Open App.Path & "\c_drawable.tat" For Append As #1 Print #1, X & "f,", "0.0f,", Y & "f,"; 記錄點(diǎn)擊的位置 Close #1 End Sub Private Sub DrawLines(ByVal X As Long, ByVal Y As Long) 畫網(wǎng)格,描記圖形時(shí)用 Picture1.FillStyle = 0 Picture1.FillColor = vbRed Picture1.Line (0, 1)-(0, -1) Picture1.Line (-ratio / 2, 0)-(ratio / 2, 0) End Sub 程序中用到的圖片資源:紅玫瑰.gif ILU.tat文件記錄的數(shù)據(jù) 1575 2295 1530 3450 1575 4590 1515 5775 1485 6885 1470 8025 3885 2310 3855 3465 3900 4590 3840 5760 3840 6900 3765 7995 4560 8040 5610 7995 7065 3045 6015 4065 5865 5340 6015 6420 6675 7320 7140 7590 7755 7080 8160 6165 8160 4995 7665 3840 8535 2850 8805 3765 9090 4980 9315 5985 9555 6870 10050 7485 10755 6660 11220 5595 11430 4515 11685 3525 11850 2730 12525 2685 13170 2685 14205 2685 12405 3735 12420 4875 12450 5820 12420 6780 12390 7545 13410 7500 14475 7590 13125 5040 13935 4995 16080 2685 16065 3810 16215 5010 16560 6090 17145 7200 17970 7260 18480 6345 18660 5175 18900 3930 18930 3195 19005 2625 其他文件數(shù)據(jù)附于文末 運(yùn)行時(shí)截圖: 程序運(yùn)行是動(dòng)態(tài)的,這是瞬間截圖 TX.tat數(shù)據(jù) 8835 3300 8160 2895 7140 2490 6195 2610 5655 3315 5505 4305 5685 5460 6120 6465 6945 7380 7680 8145 8460 8625 9270 8910 10065 8580 10935 8040 11520 7410 12135 6525 12615 5595 12960 4425 13020 3540 12885 2685 12345 2130 11655 2115 10800 2370 9960 2745 9435 3030 7605 2640 6555 2520 5820 2955 5565 3795 5565 4935 5895 6030 6465 6840 7290 7755 8070 8355 8895 8730 9720 8685 10500 8235 11205 7680 11775 6855 12330 6015 12840 5025 8580 4650 7725 4140 7515 5265 6990 4545 6975 3825 6240 4260 6555 3300 7230 3210 8010 3510 8550 3900 8100 5625 7965 4770 6930 5130 6255 4905 6300 5400 6615 6015 7080 5670 7245 6585 7605 6030 6885 6345 7665 7140 8175 7800 7530 7620 8220 6570 8385 7290 8925 6735 8925 7380 8805 7890 8580 8250 9045 8295 9555 7815 9690 8265 10275 7860 9945 7485 9480 7185 10665 7125 10740 7500 11235 7080 10035 6990 9585 6495 8880 6150 8475 5955 8595 5250 9075 5235 9030 5535 9765 5865 9705 5400 9705 4785 9075 4530 9075 3930 9540 3975 9600 3450 10125 3180 10125 3840 10245 4365 9765 4275 10740 3225 10740 2790 11400 2820 11850 2670 12240 2805 12015 3285 11295 3270 11370 3810 10830 3840 10710 4290 11295 4230 12000 4170 11865 3735 12375 3705 12480 3210 10170 4965 10365 5460 11355 5520 11145 5175 10950 5655 10500 6000 10050 6120 10320 6570 10845 6300 11190 6690 10800 6645 11610 6390 11250 6090 10725 4875 11520 4770 11250 4665 12435 4155 12885 3960 12330 4770 12000 4650 11895 5130 12450 5265 11970 5490 11700 5730 11805 6030 12195 5685 XHM.tat數(shù)據(jù) 1485 2265 2325 2310 3210 2295 4140 2340 5220 2340 3240 1410 3150 2895 3075 3585 2100 3045 4215 3120 1635 4050 2715 4110 4080 4215 1830 4680 2790 4755 3735 4710 3870 5520 1710 5385 1695 6015 2595 6135 3810 6240 1920 6870 3390 6945 450 7800 1515 7785 2745 7800 3960 7800 5295 7770 1305 8475 2070 8505 3270 8520 3315 9390 1155 9180 1170 9840 2175 9900 3360 10020 6405 3615 7290 3645 8400 3615 8100 4335 7155 5325 6570 6285 6165 6795 6780 4590 7740 6135 9375 3000 8985 4035 8685 4830 9750 4005 10770 3990 11580 3990 12435 3915 12045 4725 10200 4485 9750 5295 9270 6015 8805 6780 8295 7440 10230 5895 10695 6540 11160 7230 13845 2655 13845 3480 13845 4335 14745 2640 15465 2595 15525 3540 15495 4335 14625 4320 16410 2565 17250 2625 18105 2535 18630 2520 18360 3630 17925 4590 17610 5205 16950 3480 16635 4410 16095 5325 15495 6045 16800 6015 17910 5955 18825 5895 18765 6765 18435 7680 18300 8415 18105 9120 17430 8595 13710 7335 15195 7290 16440 7275 17250 7230 XL.tat數(shù)據(jù) 5505 2985 6900 2340 9000 2055 11100 2310 12000 3630 12270 5835 4905 4800 5145 6495 6465 7635 7650 8475 9765 8280 11505 7320 5985 4080 6810 3855 7695 3960 7860 4410 9030 4470 9435 4125 10260 3885 10845 4155 11250 4770 6720 6210 7260 6675 8070 7005 9045 6885 9600 6390 10020 6090 12240 4785 11565 2865 9990 2040 7725 2115 6165 2595 5115 3870 4905 5580 5760 7080 6945 8055 8595 8430 10605 7755 12030 6525 將上述文件數(shù)據(jù)復(fù)制到文本文件中,后綴名改為tat- 1.請仔細(xì)閱讀文檔,確保文檔完整性,對于不預(yù)覽、不比對內(nèi)容而直接下載帶來的問題本站不予受理。
- 2.下載的文檔,不會(huì)出現(xiàn)我們的網(wǎng)址水印。
- 3、該文檔所得收入(下載+內(nèi)容+預(yù)覽)歸上傳者、原創(chuàng)作者;如果您是本文檔原作者,請點(diǎn)此認(rèn)領(lǐng)!既往收益都?xì)w您。
下載文檔到電腦,查找使用更方便
0 積分
下載 |
- 配套講稿:
如PPT文件的首頁顯示word圖標(biāo),表示該P(yáng)PT已包含配套word講稿。雙擊word圖標(biāo)可打開word文檔。
- 特殊限制:
部分文檔作品中含有的國旗、國徽等圖片,僅作為作品整體效果示例展示,禁止商用。設(shè)計(jì)者僅對作品中獨(dú)創(chuàng)性部分享有著作權(quán)。
- 關(guān) 鍵 詞:
- 表白 程序 VB 源碼
鏈接地址:http://kudomayuko.com/p-6637115.html