添加以下控件:
一个CheckBox控件(check1)、一个按钮(command1)、两个文本框(text1 和 text2)、一个计时器(timer1)。
添加以下代码:
Option Explicit
Dim i As Integer
Private Sub Command1_Click()
Timer1.Enabled = True
Text2.Text = ""
i = 0
End Sub
Private Sub Form_Load()
Me.Caption = "文字打印机"
Me.Width = 10000
Me.Height = 2500
Check1.Caption = "循环"
Check1.Move 500, 1300, 2000
Command1.Caption = "开始"
Command1.Move 4000, 1400, 2000, 400
Text1.Move 500, 500, 9000, 300
Text1.Text = "Visual Basic 联机帮助中没有找到指定的关键字,可能是您拼写有误、选择了错误的文本、或者不是的关键字。"
Text2.Move 500, 1000, 9000, 300
Text2.Text = ""
Timer1.Enabled = False
Timer1.Interval = 200
End Sub
Private Sub Timer1_Timer()
i = i + 1
If i > Len(Text1.Text) Then
If Check1.Value = 1 Then
Command1_Click
Else
Timer1.Enabled = False
End If
Else
Text2.Text = Left(Text1.Text, i)
End If
End Sub