这两段vb代码什么意思啊?最好每一行解释一下,谢谢
1.DimsAsString,nlAsString*2Timer1.Enabled=FalseText1=Timer1.Intervalss=""nl=Chr$(13)&...
1.
Dim s As String, nl As String * 2
Timer1.Enabled = False
Text1 = Timer1.Interval
ss = ""
nl = Chr$(13) & Chr(10)
Open App.Path & "\test.txt" For Input As #1
While Not EOF(1)
Line Input #1, s
ss = ss & s & nl
Wend
Close #1
2.
Dim sw As String, CurX As Single, CurY As Single
CurX = Picture1.CurrentX
CurY = Picture1.CurrentY
Picture1.Line (CurX, CurY)-(CurX + 300, CurY + 300), Picture1.BackColor, BF
Picture1.CurrentX = CurX: Picture1.CurrentY = CurY
sp = sp + 1
If sp > Len(ss) Then
Timer1.Enabled = False
Else
sw = Mid(ss, sp, 1)
If Asc(sw) = 13 Then
Picture1.Print ""
sp = sp + 1: sw = Mid(ss, sp, 1)
Else
Picture1.Print sw;
End If
CurX = Picture1.CurrentX: CurY = Picture1.CurrentY
Picture1.Line (CurX + 20, CurY + 230)-(CurX + 120, CurY + 240), _
QBColor(0), BF
Picture1.CurrentX = CurX: Picture1.CurrentY = CurY
End If 展开
Dim s As String, nl As String * 2
Timer1.Enabled = False
Text1 = Timer1.Interval
ss = ""
nl = Chr$(13) & Chr(10)
Open App.Path & "\test.txt" For Input As #1
While Not EOF(1)
Line Input #1, s
ss = ss & s & nl
Wend
Close #1
2.
Dim sw As String, CurX As Single, CurY As Single
CurX = Picture1.CurrentX
CurY = Picture1.CurrentY
Picture1.Line (CurX, CurY)-(CurX + 300, CurY + 300), Picture1.BackColor, BF
Picture1.CurrentX = CurX: Picture1.CurrentY = CurY
sp = sp + 1
If sp > Len(ss) Then
Timer1.Enabled = False
Else
sw = Mid(ss, sp, 1)
If Asc(sw) = 13 Then
Picture1.Print ""
sp = sp + 1: sw = Mid(ss, sp, 1)
Else
Picture1.Print sw;
End If
CurX = Picture1.CurrentX: CurY = Picture1.CurrentY
Picture1.Line (CurX + 20, CurY + 230)-(CurX + 120, CurY + 240), _
QBColor(0), BF
Picture1.CurrentX = CurX: Picture1.CurrentY = CurY
End If 展开
展开全部
时间有限,我只对部分代码给些注释,重复的代码就不说了:
Dim s As String, nl As String * 2
Timer1.Enabled = False '将定时器禁用,定时器的作用是间隔指定的时间段然后运行指定定时的代码,循环往复
Text1 = Timer1.Interval 'Interval是定时器的一个属性,指定定时器多少毫秒触发一个事件。这个语句将这个毫秒值显示到Text1文本框中
ss = "" '将字符串设置为空字符串
nl = Chr$(13) & Chr(10) '这里其实直接用vbCrlf这个VB常量即可
Open App.Path & "\test.txt" For Input As #1 '这里是将当前目录下的text.txt文件打开,作为#1(1号文件)
While Not EOF(1) 'while循环,Not EOF(1)是循环条件,当“Not EOF(1)”为真的时候,执行循环体,否则退出循环。
Line Input #1, s '读取一行文字
ss = ss & s & nl '拼接文字,并且加上换行回车
Wend
Close #1
2.
Dim sw As String, CurX As Single, CurY As Single
CurX = Picture1.CurrentX '获取图片框中当前绘制点的x轴坐标
CurY = Picture1.CurrentY '获取图片框中当前绘制点的y轴坐标
Picture1.Line (CurX, CurY)-(CurX + 300, CurY + 300), Picture1.BackColor, BF
Picture1.CurrentX = CurX: Picture1.CurrentY = CurY
sp = sp + 1
If sp > Len(ss) Then
Timer1.Enabled = False
Else
sw = Mid(ss, sp, 1)
If Asc(sw) = 13 Then
Picture1.Print ""
sp = sp + 1: sw = Mid(ss, sp, 1)
Else
Picture1.Print sw;
End If
CurX = Picture1.CurrentX: CurY = Picture1.CurrentY
Picture1.Line (CurX + 20, CurY + 230)-(CurX + 120, CurY + 240), _
QBColor(0), BF
Picture1.CurrentX = CurX: Picture1.CurrentY = CurY
End If
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询