📄 sort.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "猜数游戏"
ClientHeight = 4230
ClientLeft = 1455
ClientTop = 1710
ClientWidth = 5625
ForeColor = &H80000008&
LinkTopic = "Form1"
PaletteMode = 1 'UseZOrder
ScaleHeight = 4230
ScaleWidth = 5625
Begin VB.CommandButton cmdRestart
Caption = "重新开始"
Height = 375
Left = 4320
TabIndex = 5
Top = 3840
Width = 1095
End
Begin VB.CommandButton cmdOK
Caption = "确定"
Height = 375
Left = 3840
TabIndex = 3
Top = 1560
Width = 975
End
Begin VB.TextBox txtInput
Height = 375
Left = 2160
TabIndex = 0
Text = "txtInput"
Top = 1560
Width = 1335
End
Begin VB.Label Label1
BackColor = &H80000009&
BackStyle = 0 'Transparent
Caption = "猜数小游戏规则:计算机随机给定一个1-128之间的整数,计算机会根据你猜的数提示你比该数是大了还是小了,直到猜中。看谁猜的最快!"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Left = 480
TabIndex = 4
Top = 240
Width = 4575
End
Begin VB.Label lblMessage
BackColor = &H80000005&
Caption = "提示信息:(lblMessage):"
Height = 855
Left = 1440
TabIndex = 2
Top = 2640
Width = 2775
End
Begin VB.Label Label4
BackColor = &H80000005&
Caption = "我猜数字是:"
Height = 255
Left = 1080
TabIndex = 1
Top = 1560
Width = 1095
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim iGuess As Integer, iCount As Integer
Private Sub cmdOK_Click()
iCount = iCount + 1
If Val(txtInput) = iGuess Then
lblMessage = " 恭喜你,猜对了!"
Else
If Val(txtInput) > iGuess Then
lblMessage = txtInput & " 太大了 ... ,已经猜测次数:" & iCount
Else
lblMessage = txtInput & " 太小了 ... ,已经猜测次数:" & iCount
End If
End If
End Sub
Private Sub cmdRestart_Click()
Randomize
iGuess = Fix(Rnd * 127 + 1)
lblMessage = ""
End Sub
Private Sub Form_Load()
Randomize
iGuess = Fix(Rnd * 127 + 1)
txtInput = ""
lblMessage = ""
End Sub
Private Sub txtInput_Click()
txtInput = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -