📄 文本动态显示.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "Form1"
ClientHeight = 3630
ClientLeft = 45
ClientTop = 330
ClientWidth = 5430
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3630
ScaleWidth = 5430
StartUpPosition = 3 '窗口缺省
Begin VB.Timer Timer2
Enabled = 0 'False
Interval = 2000
Left = 4440
Top = 1320
End
Begin VB.Timer Timer1
Left = 3960
Top = 1320
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim L As Long
Dim I As Long
Dim X As Long
Dim Y As Long
Dim Page As Long
Dim FileNum As Long
Dim Words As String
Private Sub Form_Load()
ChDrive App.Path
ChDir App.Path
FileName$ = "test.txt"
FileNum = FreeFile
Open FileName$ For Input As #FileNum
Do While Not EOF(FileNum)
Line Input #FileNum, Text$
Words = Words + Text$ + Chr(13) + Chr(10)
Loop
Close #FileNum
L = Len(Words)
Timer1.Enabled = True
Timer1.Interval = 200
End Sub
Private Sub Timer1_Timer()
If Page = 1 Then
Form1.Cls
Page = 0
Timer1.Interval = 200
End If
TypeWrite
End Sub
Private Sub TypeWrite()
I = I + 1
X = X + 1
CurrentX = 60
CurrentY = 200
CurrentX = CurrentX + X * 250
CurrentY = CurrentY + Y * 280
t$ = Mid(Words, I, 1)
Print t$
If X = 20 Or Mid(Words, I, 2) = Chr(13) + Chr(10) Then
Y = Y + 1
X = 0
End If
If Y = 12 Then
Page = 1
Y = 0
Timer1.Interval = 3000
End If
If I > L Then
Timer1.Enabled = False
Timer2.Enabled = True
End If
End Sub
Private Sub Timer2_Timer()
Timer2.Enabled = False
Timer1.Enabled = False
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -