发表于:2007-07-30 09:53:00
11楼
Private Sub ClearBuf()
Dim i As Integer
For i = 0 To DataNo 'Clear overall buffers
fABuf(i) = -100
fTBuf(i) = -100
Next
fAMax = 0: fAMin = 0 'Set to default value
fTMax = 49: fTMin = 1
End Sub
Private Sub ShiftBuf(ByVal PicIdx As Integer)
Dim i As Integer
If PicIdx = 1 Then
For i = 1 To DataNo - 1 'Left Shift these buffers
If fABuf(i + 1) <> -100 Then
fABuf(i) = fABuf(i + 1)
End If
Next
Else
For i = 1 To DataNo - 1 'Left Shift these buffers
If fTBuf(i + 1) <> -100 Then
fTBuf(i) = fTBuf(i + 1)
End If
Next
End If
End Sub
Private Sub DrawPic(ByVal PicIdx As Integer)
Dim i As Integer
If PicIdx = 1 Then
'Set the scale of picture1
Picture1.Scale (0, fAMin - 1)-(DataNo, fAMax + 1)
'set the Max/Min/Middle value
lAMax.Caption = fAMax + 1
lAMin.Caption = fAMin - 1
lAMid.Caption = (fAMax + fAMin) / 2
'Clear these picture
Picture1.Cls
'Draw the middle line
Picture1.ForeColor = &HFF00FF
Picture1.Line (1, lAMid.Caption)-(DataNo - 1, lAMid.Caption)
'Draw values as lines
Picture1.ForeColor = &HFF
For i = 1 To DataNo - 1
If fABuf(i) <> -100 Then
If fABuf(i - 1) = -100 Then
Picture1.PSet (i, fAMax - fABuf(i))
Else
Picture1.Line -(i, fAMax - fABuf(i))
End If
End If
DoEvents
Next i
Else
'Set the scale of picture2
Picture2.Scale (0, fTMin - 1)-(DataNo, fTMax + 1)
'set the Max/Min/Middle value
lTMax.Caption = fTMax + 1
lTMin.Caption = fTMin - 1
lTMid.Caption = (fTMax + fTMin) / 2
'Clear these picture
Picture2.Cls
'Draw the middle line
Picture2.ForeColor = &HFF00FF
Picture2.Line (1, lTMid.Caption)-(DataNo - 1, lTMid.Caption)
'Draw values as lines
Picture2.ForeColor = &HFF
For i = 1 To DataNo - 1
If fTBuf(i) <> -100 Then
If fTBuf(i - 1) = -100 Then
Picture2.PSet (i, fTMax - fTBuf(i))
Else
Picture2.Line -(i, fTMax - fTBuf(i))
End If
End If
DoEvents
Next i
End If
End Sub