如何实现文本动态显示
?牐牭谝徊剑盒陆ㄒ桓龃疤澹柚么疤迨粜浴I柚煤么疤宕笮 ⒋疤灞尘吧⒆痔濉⒆痔逖丈?
?牐牭诙剑涸诖疤迳咸砑恿礁黾剖逼鳌I柚肨imer1的属性:Interval=200,设置Timer2的属性:Enabled=False,interval=5000。
?牐牭谌剑罕嘈创搿?
?牐燚im l As Integer
?牐燚im i As Integer
?牐燚im x As Integer
?牐燚im y As Integer
?牐燚im page As Integer
?牐燚im filenum As Integer
?牐燚im words As String
?牐燩rivate Sub Form_Load()
?牐燙hDrive App.Path
?牐燙hDir App.Path
?牐燜ileName$ = "test.txt"
?牐爁ilenum = FreeFile
?牐燨pen FileName$ For Input As #filenum
?牐燚o While Not EOF(filenum)
?牐燣ine Input #filenum, Text$
?牐爓ords = words + Text$ + Chr(13) + Chr(10) '将文本内容赋值给words串变量,包括回车符和换行符
?牐燣oop
?牐燙lose #filenum
?牐爈 = Len(words) '计算words串变量长度(字符个数)
?牐燛nd Sub
?牐燩rivate Sub Timer1_Timer()
?牐營f page = 1 Then '满一页后清除窗体内容
?牐燜orm1.Cls
?牐爌age = 0
?牐燭imer1.Interval = 200 '重置打字速度
?牐燛nd If
?牐爐ypewrite '调用打字子例程
?牐燛nd Sub
?牐燩ublic Sub typewrite()
?牐爄 = i + 1 '字符计数器
?牐爔 = x + 1
?牐燙urrentX = 100 '设置打字的起始点
?牐燙urrentY = 300
?牐燙urrentX = CurrentX + x * 250 '设置字间距
?牐燙urrentY = CurrentY + y * 280 '设置行间距
?牐爐$ = Mid$(words, i, 1) '从words串中指定位置取一个汉字或标点符号
?牐燩rint t$ '在窗体上打印一个字符
?牐營f x = 20 Or Mid$(words, i, 2) = Chr$(13) + Chr$(10) Then '设置行字符个数,若行字符数满或段落结束(遇回车换行符)则换行
?牐爕 = y + 1
?牐爔 = 0
?牐燛nd If
?牐營f y = 12 Then '设置行数
?牐爌age = 1 '行数满为一页
?牐爕 = 0
?牐燭imer1.Interval = 6000 '设置页显示停留时间
?牐燛nd If
?牐營f i > l Then '文本内容打印完毕,计时器2打开
?牐燭imer1.Enabled = False
?牐燭imer2.Enabled = True
?牐燛nd If
?牐燛nd Sub
?牐燩rivate Sub Timer2_Timer()
?牐燭imer2.Enabled = False
?牐燭imer1.Enabled = False
?牐燛nd '改变end,可执行其他子例程
?牐燛nd Sub
?牐犠詈螅嗉迷は允镜奈谋灸谌荩纯稍诵形谋径允境绦颉?