📄 frmusr.frm
字号:
VERSION 5.00
Begin VB.Form frmUsr
Caption = "Tip of the Day"
ClientHeight = 1125
ClientLeft = 2370
ClientTop = 2400
ClientWidth = 5415
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1125
ScaleWidth = 5415
WhatsThisButton = -1 'True
WhatsThisHelp = -1 'True
Begin VB.TextBox tUsrName
Height = 405
Left = 1920
TabIndex = 1
Top = 240
Width = 2415
End
Begin VB.CommandButton cmdOK
Cancel = -1 'True
Caption = "OK"
Default = -1 'True
Height = 375
Left = 4560
TabIndex = 0
Top = 240
Width = 855
End
Begin VB.Label Label1
Caption = "大侠! 请留下你的大名:"
Height = 375
Left = 120
TabIndex = 2
Top = 240
Width = 1695
End
End
Attribute VB_Name = "frmUsr"
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.
frmTip.DisplayCurrentTip
End Sub
Function LoadTips(sFile As String) As Boolean
Dim NextTip As String ' Each tip read in from file.
Dim InFile As Integer ' Descriptor for file.
' Obtain the next free file descriptor.
InFile = FreeFile
' 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)
Line Input #InFile, NextTip
Tips.Add NextTip
Wend
Close InFile
' Display a tip at random.
DoNextTip
LoadTips = True
End Function
Private Sub chkLoadTipsAtStartup_Click()
' save whether or not this form should be displayed at startup
SaveSetting App.EXEName, "Options", "Show Tips at Startup", chkLoadTipsAtStartup.Value
End Sub
Private Sub cmdNextTip_Click()
DoNextTip
End Sub
Private Sub cmdOK_Click()
strUsrName = tUsrName.Text
frmUsr.Hide
End Sub
Public Sub DisplayCurrentTip()
If Tips.Count > 0 Then
lblTipText.Caption = Tips.Item(CurrentTip)
End If
End Sub
Private Sub OKButton_Click()
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -