📄 frmmain.frm
字号:
Width = 375
End
Begin VB.TextBox TxtNum
BackColor = &H00C0E0FF&
Enabled = 0 'False
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 0
Left = 360
TabIndex = 0
Top = 360
Width = 375
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
ForeColor = &H000000FF&
Height = 255
Left = 960
TabIndex = 20
Top = 1200
Width = 615
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "欢迎使用数字游戏"
ForeColor = &H000000FF&
Height = 255
Left = 600
TabIndex = 11
Top = 960
Width = 1695
End
End
Begin VB.Frame Frame3
BackColor = &H00C0C0FF&
Height = 2055
Left = 480
TabIndex = 12
Top = 240
Width = 2295
Begin VB.Label LblJie
BackColor = &H00C0FFFF&
Height = 255
Index = 6
Left = 240
TabIndex = 19
Top = 1680
Width = 1815
End
Begin VB.Label LblJie
BackColor = &H00C0FFC0&
Height = 255
Index = 5
Left = 240
TabIndex = 18
Top = 1440
Width = 1815
End
Begin VB.Label LblJie
BackColor = &H00C0FFFF&
Height = 255
Index = 4
Left = 240
TabIndex = 17
Top = 1200
Width = 1815
End
Begin VB.Label LblJie
BackColor = &H00C0FFC0&
Height = 255
Index = 3
Left = 240
TabIndex = 16
Top = 960
Width = 1815
End
Begin VB.Label LblJie
BackColor = &H00C0FFFF&
Height = 255
Index = 2
Left = 240
TabIndex = 15
Top = 720
Width = 1815
End
Begin VB.Label LblJie
BackColor = &H00C0FFC0&
Height = 255
Index = 1
Left = 240
TabIndex = 14
Top = 480
Width = 1815
End
Begin VB.Label LblJie
BackColor = &H00C0FFFF&
Height = 255
Index = 0
Left = 240
TabIndex = 13
Top = 240
Width = 1815
End
End
Begin VB.Menu MnuGameTime
Caption = ""
Visible = 0 'False
Begin VB.Menu MnuMaxTime
Caption = "100秒"
Checked = -1 'True
End
Begin VB.Menu seg3
Caption = "-"
End
Begin VB.Menu MnuHs
Caption = "50秒"
Checked = -1 'True
End
Begin VB.Menu seg10
Caption = "-"
End
Begin VB.Menu MnuSs
Caption = "30秒"
Checked = -1 'True
End
Begin VB.Menu seg1
Caption = "-"
End
Begin VB.Menu MnuFs
Caption = "20秒"
Checked = -1 'True
End
Begin VB.Menu seg2
Caption = "-"
End
Begin VB.Menu MnuTs
Caption = "15秒"
Checked = -1 'True
End
End
Begin VB.Menu Mnumovie
Caption = ""
Visible = 0 'False
Begin VB.Menu Mnufast
Caption = "快速"
Checked = -1 'True
End
Begin VB.Menu SEG4
Caption = "-"
End
Begin VB.Menu MnuNormal
Caption = "正常"
Checked = -1 'True
End
Begin VB.Menu seg5
Caption = "-"
End
Begin VB.Menu MnuMan
Caption = "慢速"
Checked = -1 'True
End
End
Begin VB.Menu MnuSet
Caption = ""
Visible = 0 'False
Begin VB.Menu MnuSetLeft
Caption = "("
End
Begin VB.Menu seg6
Caption = "-"
End
Begin VB.Menu MnuSetRight
Caption = ")"
End
Begin VB.Menu seg7
Caption = "-"
End
Begin VB.Menu MnuSetAdd
Caption = "+"
End
Begin VB.Menu seg8
Caption = "-"
End
Begin VB.Menu MnuSetB
Caption = "--"
End
Begin VB.Menu seg9
Caption = "-"
End
Begin VB.Menu MnuSetD
Caption = "*"
End
Begin VB.Menu seg0
Caption = "-"
End
Begin VB.Menu MnuSetS
Caption = "/"
End
End
End
Attribute VB_Name = "FrmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Dim Num(3) As Integer
Dim Num24(3) As Integer
Dim Num10(9) As Integer
Dim Win1 As Integer
Dim Win2 As Integer
Dim l As Integer
Dim He As Boolean
Dim MyJie As Double
Dim MyTime
Dim Yes24 As Integer
Dim FalseFlag As Boolean
Dim BackFlag As Boolean
Dim LblNum As Integer
Private Sub CmdAnswer_Click()
Dim s As Integer
Label1.Caption = Num(0) & Num(1) & Num(2) & Num(3)
For s = 0 To 3
TxtNum(s) = Num(s)
Next
TxtNum(0).SetFocus
End Sub
Private Sub CmdJie24_Click()
Beep
TimGameTime.Enabled = False
CmdOk24.Enabled = False
CmdJie24.Enabled = False
Command2.Enabled = False
CmdNew24.Enabled = True
If AddNum = 1 Then Text4.Text = "((" & Num24(Pi) & MyA(Pm) & Num24(Pj) & ")" & MyA(Pn) & Num24(Pk) & ")" & MyA(Po) & Num24(Pl)
If AddNum = 2 Then Text4.Text = "(" & Num24(Pi) & MyA(Pm) & Num24(Pj) & ")" & MyA(Pn) & "(" & Num24(Pk) & MyA(Po) & Num24(Pl) & ")"
If AddNum = 3 Then Text4.Text = "(" & Num24(Pi) & MyA(Pm) & "(" & Num24(Pj) & MyA(Pn) & Num24(Pk) & "))" & MyA(Po) & Num24(Pl)
If AddNum = 4 Then Text4.Text = Num24(Pi) & MyA(Pm) & "((" & Num24(Pj) & MyA(Pn) & Num24(Pk) & ")" & MyA(Po) & Num24(Pl) & ")"
If AddNum = 5 Then Text4.Text = Num24(Pi) & MyA(Pm) & "(" & Num24(Pj) & MyA(Pn) & "(" & Num24(Pk) & MyA(Po) & Num24(Pl) & "))"
End Sub
Private Sub CmdNew24_Click()
Dim s As Integer
CmdNew24.Enabled = False
II:
For s = 0 To 3
Randomize
Image1(s).Enabled = True
Num24(s) = Rnd * 12 + 1
Image1(s).Picture = LoadPicture(App.Path & "\" & Num24(s))
Next
If PanDuan(Num24()) = False Then
MsgBox "此题无解!", , "挑战24点V3.10版"
GoTo II
End If
TimGameTime.Enabled = True
CmdOk24.Enabled = True
CmdJie24.Enabled = True
Command2.Enabled = True
Text4.Enabled = True
Text4.Text = ""
Text4.SetFocus
MyTime = Timer()
Beep
End Sub
Private Sub CmdOk_Click()
Dim c As Integer
Win1 = 0
Win2 = 0
Dim s As Integer
For s = 0 To 3
If TxtNum(s).Text = "" Then
MsgBox "错误的输入,请修改!", , "猜数字"
TxtNum(s).SetFocus
Exit Sub
End If
If TxtNum(s).Text = Num(s) Then
Win1 = Win1 + 1
Else
For h = 0 To 3
If TxtNum(s) = Num(h) Then Win2 = Win2 + 1
Next
End If
Next
If Win1 >= 4 Then
Label3.Caption = "恭喜你!顺利过关!"
CmdStart.Enabled = True
Label1.Caption = Num(0) & Num(1) & Num(2) & Num(3)
CmdOk.Enabled = False
CmdAnswer.Enabled = False
l = 0
For s = 0 To 3
Num(s) = 0
TxtNum(s).Text = ""
TxtNum(s).Enabled = False
Next
Exit Sub
End If
If l >= 7 Then
Label3.Caption = "对不起,你输了!"
CmdStart.Enabled = True
Label1.Caption = Num(0) & Num(1) & Num(2) & Num(3)
CmdOk.Enabled = False
CmdAnswer.Enabled = False
l = 0
Label1.Caption = Num(0) & Num(1) & Num(2) & Num(3)
For s = 0 To 3
Num(s) = 0
TxtNum(s).Text = ""
TxtNum(s).Enabled = False
Next
Exit Sub
Else
Label3.Caption = "你还有" & 7 - l & "次机会"
End If
LblJie(l).Caption = TxtNum(0).Text & TxtNum(1).Text & TxtNum(2).Text & TxtNum(3).Text & " A:" & Win1 & " B:" & Win2
l = l + 1
TxtNum(0).SetFocus
For c = 0 To 3
TxtNum(c).Text = ""
Next
End Sub
Private Sub CmdOk24_Click()
Beep
If Len(Text4.Text) < 7 Or Len(Text4.Text) > 11 Then
MsgBox "算式错误,请检查后继续!", , "挑战24点V3.10版"
Exit Sub
End If
Dim ltext, rtext, mtext As String
If Len(Text4.Text) = 9 And Mid(Text4.Text, 1, 1) = "(" And Mid(Text4.Text, 7, 1) = ")" Then
If Mid(Text4.Text, 5, 1) = "-" Or Mid(Text4.Text, 5, 1) = "+" Then
ltext = Left(Text4.Text, 4)
rtext = Right(Text4.Text, 5)
Text4.Text = "(" & ltext & ")" & rtext
Else
If Mid(Text4.Text, 5, 1) = "*" And Mid(Text4.Text, 3, 1) = "/" Then
ltext = Left(Text4.Text, 4)
rtext = Right(Text4.Text, 5)
Text4.Text = "(" & ltext & ")" & rtext
Else
ltext = Left(Text4.Text, 3)
rtext = Right(Text4.Text, 3)
mtext = Mid(Text4.Text, 4, 3)
Text4.Text = ltext & "(" & mtext & ")" & rtext
End If
End If
End If
If Len(Text4.Text) = 9 And Mid(Text4.Text, 3, 1) = "(" And Mid(Text4.Text, 9, 1) = ")" Then
If Mid(Text4.Text, 7, 1) = "-" Or Mid(Text4.Text, 7, 1) = "+" Then
ltext = Left(Text4.Text, 2)
rtext = Right(Text4.Text, 3)
mtext = Mid(Text4.Text, 3, 4)
Text4.Text = ltext & "(" & mtext & ")" & rtext
Else
If Mid(Text4.Text, 7, 1) = "*" And Mid(Text4.Text, 5, 1) = "/" Then
ltext = Left(Text4.Text, 2)
rtext = Right(Text4.Text, 3)
mtext = Mid(Text4.Text, 3, 4)
Text4.Text = ltext & "(" & mtext & ")" & rtext
Else
ltext = Left(Text4.Text, 5)
rtext = Right(Text4.Text, 4)
Text4.Text = ltext & "(" & rtext & ")"
End If
End If
End If
If Len(Text4.Text) = 7 Then
If FuHao(Mid(Text4.Text, 2, 1), Mid(Text4.Text, 4, 1)) = True Then
If FuHao(Mid(Text4.Text, 4, 1), Mid(Text4.Text, 6, 1)) = True Then
ltext = Left(Text4.Text, 3)
mtext = Mid(Text4.Text, 4, 2)
rtext = Right(Text4.Text, 2)
Text4.Text = "((" & ltext & ")" & mtext & ")" & rtext
Else
ltext = Left(Text4.Text, 3)
mtext = Mid(Text4.Text, 4, 1)
rtext = Right(Text4.Text, 3)
Text4.Text = "(" & ltext & ")" & mtext & "(" & rtext & ")"
End If
Else
If FuHao(Mid(Text4.Text, 4, 1), Mid(Text4.Text, 6, 1)) = True Then
ltext = Left(Text4.Text, 2)
mtext = Mid(Text4.Text, 3, 3)
rtext = Right(Text4.Text, 2)
Text4.Text = ltext & "((" & mtext & ")" & rtext & ")"
Else
ltext = Left(Text4.Text, 2)
mtext = Mid(Text4.Text, 3, 2)
rtext = Right(Text4.Text, 3)
Text4.Text = ltext & "(" & mtext & "(" & rtext & "))"
End If
End If
End If
If JiSuanAnswer(Text4.Text) Then
MsgBox "恭喜过关,请继续下一个游戏!", , "挑战24点V3.10版"
TimGameTime.Enabled = False
CmdNew24.Enabled = True
CmdOk24.Enabled = False
CmdJie24.Enabled = False
Command2.Enabled = False
CmdNew24_Click
Else
If FormFlag = False Then
ms = MsgBox("结果错误,请继续!" & vbCrLf & "你的结果是:" & Game24Answer, , "挑战24点V3.10版")
FalseFlag = True
If ms = vbOK Then FalseFlag = False
End If
For mm = 0 To 3
Image1(mm).Enabled = True
Next
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -