'贴出来分享一下,呵呵
Private Sub Command1_Click()
'从文件取数据
cmDia.InitDir = App.Path
cmDia.Filter = "*.dat|*.dat"
cmDia.ShowOpen
h = FreeFile
Open cmDia.FileName For Binary As h
tmp = Input(LOF(h), h)
Close h
'处理数据
s = Split(tmp, vbCrLf)
c = UBound(s)
If c > 0 Then
ss1 = Split(s(0), " ") 'row 1
ss2 = Split(s(1), " ") 'row2
cc1 = UBound(ss1)
cc2 = UBound(ss2)
If cc1 > cc2 Then cc = cc1 Else cc = cc2
'图形自适应窗口
'长度超限制,此段只能略了
Pic1.Scale (XX1, YY2)-(XX2, YY1)
'绘制曲线
Pic1.ForeColor = vbRed
For i = 1 To cc
XX# = Val(ss1(i))
YY# = Val(ss2(i))
If (PXX# <> 0) Then
Pic1.Line (PXX#, PYY#)-(XX#, YY#)
End If
PXX = XX
PYY = YY
Next
End If
End Sub