📄 frmhint.frm
字号:
VERSION 5.00
Begin VB.Form FrmHint
Caption = "帮助"
ClientHeight = 5640
ClientLeft = 60
ClientTop = 450
ClientWidth = 5520
LinkTopic = "Form1"
ScaleHeight = 5640
ScaleWidth = 5520
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton cmdOK
Cancel = -1 'True
Caption = "确定"
Default = -1 'True
Height = 375
Left = 3675
TabIndex = 4
Top = 5040
Width = 1455
End
Begin VB.CommandButton cmdNextHint
Caption = "下一条提示(&N)"
Height = 375
Left = 2040
TabIndex = 3
Top = 5040
Width = 1455
End
Begin VB.PictureBox Picture1
BackColor = &H80000009&
Height = 4815
Left = 240
ScaleHeight = 4755
ScaleWidth = 4875
TabIndex = 0
Top = 120
Width = 4935
Begin VB.Label lblHintText
BackColor = &H80000009&
Height = 4095
Left = 120
TabIndex = 2
Top = 600
Width = 4695
End
Begin VB.Label Label1
BackColor = &H80000009&
Caption = "你知道吗?..."
Height = 375
Left = 120
TabIndex = 1
Top = 120
Width = 2055
End
End
End
Attribute VB_Name = "FrmHint"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
' 内存中的提示数据库。
Dim Hints As New Collection
' 提示文件名称
Const Hint_FILE = "HotelManager.txt"
' 当前正在显示的提示集合的索引。
Dim CurrentHint As Long
Dim ShowAtStartup As Long
Private Sub DoNextHint()
' 按顺序提示
CurrentHint = CurrentHint + 1
If Hints.Count < CurrentHint Then
CurrentHint = 1
End If
' 显示它。
FrmHint.DisplayCurrentHint
End Sub
Function LoadHints(sFile As String) As Boolean
Dim NextHint As String ' 从文件中读出的每条提示。
Dim InFile As Integer ' 文件的描述符。
' 包含下一个自由文件描述符。
InFile = FreeFile
' 确定为指定文件。
If sFile = "" Then
LoadHints = False
Exit Function
End If
' 在打开前确保文件存在。
If Dir(sFile) = "" Then
LoadHints = False
Exit Function
End If
' 从文本文件中读取集合。
Open sFile For Input As InFile
While Not EOF(InFile)
Line Input #InFile, NextHint
Hints.Add NextHint
Wend
Close InFile
' 显示一条提示。
DoNextHint
LoadHints = True
End Function
Private Sub cmdNextHint_Click()
'显示下一条提示
DoNextHint
lblHintText.Caption = Hints.Item(CurrentHint)
End Sub
Private Sub Form_Load()
' 查看在启动时是否显示
ShowAtStartup = GetSetting(App.EXEName, "Options", "在启动时显示提示", 1)
' 读取注册表内计数的值
FrmHint.DisplayCurrentHint
' 读取提示文件并且随机显示一条提示。
If LoadHints(App.Path & "\" & Hint_FILE) = False Then
lblHintText.Caption = "文件 " & Hint_FILE & " 没有被找到吗? " & vbCrLf & vbCrLf & _
"创建文本文件名为 " & Hint_FILE & " 使用记事本每行写一条提示。 " & _
"然后将它存放在应用程序所在的目录 "
End If
End Sub
Public Sub DisplayCurrentHint()
If Hints.Count > 0 Then
lblHintText.Caption = Hints.Item(CurrentHint)
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Frmmain.Enabled = True
End Sub
Private Sub cmdOK_Click()
Unload Me
Frmmain.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -