📄 frmtop10.frm
字号:
VERSION 5.00
Begin VB.Form frmTop10
Caption = "Top 10"
ClientHeight = 3840
ClientLeft = 2370
ClientTop = 2400
ClientWidth = 5415
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3840
ScaleWidth = 5415
WhatsThisButton = -1 'True
WhatsThisHelp = -1 'True
Begin VB.CommandButton Command1
Caption = "Command1"
Enabled = 0 'False
Height = 255
Left = 3360
TabIndex = 5
Top = 3360
Visible = 0 'False
Width = 975
End
Begin VB.PictureBox Picture1
BackColor = &H00FFFFFF&
Height = 3075
Left = 120
Picture = "frmTop10.frx":0000
ScaleHeight = 3015
ScaleWidth = 5115
TabIndex = 1
Top = 120
Width = 5175
Begin VB.Label Label2
BackColor = &H80000018&
Caption = " Top10"
Height = 255
Left = 1320
TabIndex = 4
Top = 120
Width = 2295
End
Begin VB.Label Label1
BackColor = &H00FFFFFF&
Caption = "Do your best to become top10"
Height = 255
Left = 2400
TabIndex = 3
Top = 2760
Width = 2655
End
Begin VB.Label lblTipText
BackColor = &H00FFFFFF&
Height = 2595
Left = 180
TabIndex = 2
Top = 480
Width = 3255
End
End
Begin VB.CommandButton cmdOK
Cancel = -1 'True
Caption = "OK"
Default = -1 'True
Height = 375
Left = 1920
TabIndex = 0
Top = 3360
Width = 975
End
End
Attribute VB_Name = "frmTop10"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
' The in-memory database of tips.
Dim Tips As New Collection
' Name of tips file
Const TIP_FILE = "TIPOFDAY.TXT"
' Index in collection of tip currently being displayed.
Dim CurrentTip As Long
Private Sub DoNextTip()
' Select a tip at random.
CurrentTip = Int((Tips.Count * Rnd) + 1)
' Or, you could cycle through the Tips in order
' CurrentTip = CurrentTip + 1
' If Tips.Count < CurrentTip Then
' CurrentTip = 1
' End If
' Show it.
frmTop10.DisplayCurrentTip
End Sub
Function LoadTips(sFile As String) As Boolean
Dim NextTip, strTop10 As String ' Each tip read in from file.
Dim InFile As Integer ' Descriptor for file.
Dim iScore As Integer '排名
' Obtain the next free file descriptor.
InFile = FreeFile
iScore = 0
' Make sure a file is specified.
If sFile = "" Then
LoadTips = False
Exit Function
End If
' Make sure the file exists before trying to open it.
If Dir(sFile) = "" Then
LoadTips = False
Exit Function
End If
' Read the collection from a text file.
Open sFile For Input As InFile
While Not EOF(InFile)
iScore = iScore + 1
Line Input #InFile, NextTip
strTop10 = strTop10 + Chr(13) + Chr(10) + "Top" + CStr(iScore) + ": " + NextTip
Wend
Close InFile
' Display a tip at random.
lblTipText.Caption = strTop10
End Function
Private Sub chkLoadTipsAtStartup_Click()
End Sub
Private Sub cmdNextTip_Click()
DoNextTip
End Sub
Private Sub cmdOK_Click()
Unload Me
End Sub
Private Sub Command1_Click()
Dim tt As Boolean
CheckTop10 "zhaoshouy", "c:\top10.txt", 15
End Sub
Private Sub Form_Load()
LoadTips ("top10.txt")
End Sub
Public Sub DisplayCurrentTip()
End Sub
Function CheckTop10(strUsr As String, sFile As String, iSeconds As Integer) As Boolean
Dim NextTip As String ' Each tip read in from file.
Dim InFile As Integer ' Descriptor for file.
Dim iScore As Integer '排名
Dim strTop10(20) As String
Dim iLoc As Integer
Dim i As Integer
' Obtain the next free file descriptor.
InFile = FreeFile
iScore = 0
iLoc = 0
i = 1
' Make sure a file is specified.
If sFile = "" Then
CheckTop10 = False
Exit Function
End If
' Make sure the file exists before trying to open it.
If Dir(sFile) = "" Then
CheckTop10 = False
Exit Function
End If
' Read the collection from a text file.
Open sFile For Input As InFile
While Not EOF(InFile)
iScore = iScore + 1
Line Input #InFile, NextTip
strTop10(iScore) = NextTip
iLoc = InStr(NextTip, "#")
NextTip = Mid(NextTip, iLoc + 1)
If iSeconds <= Int(NextTip) Then
strTop10(iScore + 1) = strUsr + "#" + Str(iSeconds)
iScore = iScore + 1
iSeconds = 9999
End If
Wend
Close InFile
Open sFile For Output As #1
While i <= 10
Print #1, strTop10(i)
i = i + 1
Wend
Close
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -