Private Sub tmrGraph_Tick(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles tmrGraph.Tick
' Move the old data over.
Dim bm As New Bitmap(picGraph.Width, picGraph.Height)
Dim gr As Graphics = Graphics.FromImage(bm)
gr.DrawImage(picGraph.Image, -m_Dx, 0)
' Erase the right edge and draw guide lines.
gr.ScaleTransform(1, -101 / picGraph.Height)
gr.TranslateTransform(0, -101)
For i As Integer = 20 To 80 Step 20
gr.DrawLine(Pens.Red, picGraph.Width - m_Dx, i, _
picGraph.Width, i)
Next i
' Plot the new value.
Dim new_value As Integer = NewValue()
gr.DrawLine(Pens.Black, _
picGraph.Width - 1 - m_Dx, m_OldValue, _
picGraph.Width - 1, new_value)
m_OldValue = new_value
' Display the results.
picGraph.Image = bm
End Sub
|