帮忙修改一下VB小程序OptionE
☆飞翔的梦★说的对,你引用的WINAPI有错误,已将代码改正,实际上你的代码API引用中多了Alias "bitblt",将其删除就可:
Option Explicit
'Private Declare Function BitBlt Lib "gdi32" Alias "Bitblt" (ByVal hDestDC As Long, ByVal x As Long, _
'ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, _
'ByVal xSrc As Long, By...全部
☆飞翔的梦★说的对,你引用的WINAPI有错误,已将代码改正,实际上你的代码API引用中多了Alias "bitblt",将其删除就可:
Option Explicit
'Private Declare Function BitBlt Lib "gdi32" Alias "Bitblt" (ByVal hDestDC As Long, ByVal x As Long, _
'ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, _
'ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Money As Long
Private Bet As Long
Private Value(2) As Integer
Private Betting As Boolean
Private Sub Form_load()
Betting = False
Money = 1000
Bet = 0
Label2。
Caption = Money
Label4。Caption = Bet
End Sub
Private Sub Command1_Click()
If Not Betting And Money >= 10 Then
Bet = Bet + 10
Money = Money - 10
Label2。
Caption = Money
Label4。Caption = Bet
Label5。Caption = ""
Label6。Caption = ""
End If
End Sub
Private Sub Command2_click()
If Bet > 0 Then
Betting = Not Betting
If Betting Then
Command2。
Caption = "停!"
Label5。Caption = ""
Else
Command2。Caption = "开始!"
If Value(0) + Value(1) + Value(2) > 6 Then
Label6。
Caption = "大"
Else
Label6。Caption = "小"
End If
If (Value(0) + Value(1) + Value(2) > 6 And Option1。
Value) Or (Value(0) + Value(1) + Value(2) < 7 And Option2。Value) Then
Money = Money + Bet * 2
Label5。
Caption = "恭喜!你赢了" & Bet & "元!"
Else
Label5。Caption = "你输了" & Bet & "元!"
If Money = 0 Then
MsgBox "请重新来过!", , "你输光了!"
End
End If
End If
Bet = 0
Label2。
Caption = Money
Label4。Caption = "0"
End If
End If
End Sub
Private Sub timer1_timer()
Dim i As Long
If Betting Then
For i = 0 To 2
Value(i) = Int(Rnd * 6)
BitBlt PicValue(i)。
hDC, 0, 0, 32, 32, Picture1。hDC, Value(i) * 32, 0, vbSrcCopy
Next
End If
End Sub
并附上修改后的工程文件:
。
收起