最近在學VB阿,看到有個777拉霸遊戲想要了解他的內容,但有點看不懂,請問有高手可以跟我說程式解說嗎?謝謝唷~~~
Private Declare Sub Sleep Lib \"kernel32\" (ByVal dwMilliseconds As Long)
Dim Cash As Long
Private Sub Command1_Click()
Dim I As Integer, J As Integer, X As Integer
If Text1 = \"\" Then Exit Sub
If Text1 = 0 Then Exit Sub
If Text1 > Cash Then
MsgBox \"餘額不足!!\"
Text1.SetFocus
Exit Sub
Else
Cash = Cash - Text1
Label2 = \"餘額:\" & Cash
End If
Label4 = \"\"
Randomize
X = Int(Rnd * 8 + 3)
For I = 1 To X
For J = 0 To 8
Sleep I * 5
DoEvents
Label1(J) = Int(Rnd * 6 + 1)
Next
Next
Cal
Beep
End Sub
Private Sub Command2_Click()
Cash = 10000
Label2 = \"餘額:10000\"
End Sub
Private Sub Form_Load()
Dim I As Integer
Randomize
For I = 0 To 8
Label1(I) = Int(Rnd * 6 + 1)
Next
Cash = 10000
End Sub
Sub Cal()
Dim R As Integer, C As Integer, I As Integer, T As Integer, S As String, B As Boolean
For C = 0 To 6 Step 3
B = True: S = Label1(C)
For R = 1 To 2
If Label1(C + R) <> S Then B = False: Exit For
Next
If B Then T = T + 1
Next
For C = 0 To 2
B = True: S = Label1(C)
For R = 3 To 6 Step 3
If Label1(C + R) <> S Then B = False: Exit For
Next
If B Then T = T + 1
Next
S = Label1(4)
If S = Label1(0) And S = Label1(8) Then T = T + 1
If S = Label1(2) And S = Label1(6) Then T = T + 1
If T = 0 Then
Label4 = \"抱歉!你輸了\"
Else
Beep
Label4 = \"恭喜!你贏了\"
Cash = Cash + (T + 1) * Text1
Label2 = \"餘額:\" & Cash
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If InStr(\"0123456789\" & Chr(8), Chr(KeyAscii)) = 0 Then KeyAscii = 0
End Sub
2006-06-03 06:51:39 · 4 個解答 · 發問者 大熊 2 in 電腦與網際網路 ➔ 程式設計
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) '使程式暫停API函數Dim Cash As Long '賭本變數Private Sub Command1_Click()Dim I As Integer, J As Integer, X As Integer'無押注金額時離開If Text1 = "" Then Exit SubIf Text1 = 0 Then Exit Sub'押注金額大於賭本時警告並重押,否則賭本就減掉押注金If Text1 > Cash Then MsgBox "餘額不足!!" Text1.SetFocus Exit SubElse Cash = Cash - Text1 Label2 = "餘額:" & CashEnd If'清除訊息Label4 = ""Randomize'X代表數字要變換幾次後才停止(3~10之間)X = Int(Rnd * 8 + 3)For I = 1 To X For J = 0 To 8 '隨機將Label(0~8)填上1~6的值 Sleep I * 5 '延長變換時間才能看到數字在轉換 DoEvents Label1(J) = Int(Rnd * 6 + 1) NextNextCal '計算是否有連線Beep '喇叭叫1聲End SubPrivate Sub Command2_Click() '賭本還原為10000Cash = 10000Label2 = "餘額:10000"End SubPrivate Sub Form_Load()Dim I As IntegerRandomize'隨機將Label(0~8)填上1~6的值For I = 0 To 8 Label1(I) = Int(Rnd * 6 + 1)Next'賭本變數為10000Cash = 10000End SubSub Cal() '計算是否有連線副程式Dim R As Integer, C As Integer, I As Integer, T As Integer, S As String, B As BooleanFor C = 0 To 6 Step 3 '檢查每一橫列是否3個數字全部相同,有的話 T=T+1 B = True: S = Label1(C) For R = 1 To 2 If Label1(C + R) <> S Then B = False: Exit For Next If B Then T = T + 1NextFor C = 0 To 2 '檢查每一直行是否3個數字全部相同,有的話 T=T+1 B = True: S = Label1(C) For R = 3 To 6 Step 3 If Label1(C + R) <> S Then B = False: Exit For Next If B Then T = T + 1Next'檢查兩對角線是否3個數字全部相同,有的話 T=T+1S = Label1(4)If S = Label1(0) And S = Label1(8) Then T = T + 1If S = Label1(2) And S = Label1(6) Then T = T + 1'若T=0表示無任何連線,否則賭本就加上押金*(T+1),並以Label4顯示訊息If T = 0 Then Label4 = "抱歉!你輸了"Else Beep Label4 = "恭喜!你贏了" Cash = Cash + (T + 1) * Text1 Label2 = "餘額:" & CashEnd IfEnd SubPrivate Sub Text1_KeyPress(KeyAscii As Integer) '限制Text1只能輸入數字If InStr("0123456789" & Chr(8), Chr(KeyAscii)) = 0 Then KeyAscii = 0End Sub
2006-06-07 00:40:01 補充:
由於您設定是不接受網友來信,故我無法回信給您XD,麻煩修改設定!
2006-06-06 15:31:28 · answer #1 · answered by W.J.S. 7 · 0⤊ 0⤋
推薦您前往黃金俱樂部遊戲網!
提供您詳盡的說明
您可以先進行遊戲下載:
網址:http://99點5888th點net
誠心服務!會員溫馨!永久服務!
第一:全程直播遊戲的公平與公正性【亞洲唯一直屬會員代理】
第二:點數儲值和託售皆在十分鐘之內完成【全台娛樂城速度最快24小時不分周末】
第三:二十四小時專業客服務線上服務全年無休【大大小小問題都可以馬上做詳細解答喔】
電子機台.真人遊戲和你一同玩樂
麻將 百家樂 5PK 德州撲克 水果盤 賓果
輪盤 21點 10點半 骰盅 牌九 鬥地主 13支
全年網站優惠活動不間斷!
快去註冊會員!免費:http://99點5888th點net
2014-07-31 22:13:46 · answer #2 · answered by Anonymous · 0⤊ 0⤋
線上遊戲天堂 http://ts999.tw
運動遊戲
實況棒球、籃球、足球、冰球、網球等多種經典賽事
即時遊戲
百家、21點、牌九、二八杠、骰寶、龍虎、輪盤、牛牛、番攤
對戰遊戲
麻將、德州撲克、二八杠、吹牛、鬥地主、13支、暗棋、接龍
電子遊戲
5PK、7PK、水果盤遊戲、5輪遊戲、極限飆速、趙雲救主、西遊戲、金瓶梅、中國美人、英雄
彩球遊戲
大樂透、六合、時時彩、今彩539、3星彩、4星彩
最新優惠活動
1. 運動遊戲連過5關,彩今再加碼10%
2. 新會員加入,有機會獲得500元禮券與精美讀卡機
3. 遊戲積分可兌換汽機車、3C、精品等多種大獎
****體驗試玩喔~!
線上遊戲天堂 http://ts999.tw
2014-01-25 19:59:57 · answer #3 · answered by Anonymous · 0⤊ 0⤋
台灣首家合法娛樂城開幕囉!
體育博彩、真人對戰、現場遊戲、彩球
投注高賠率,歡迎您來體驗!
官方網站 aa777.net
2013-12-26 02:07:00 · answer #4 · answered by Anonymous · 0⤊ 0⤋