Sub Globals
Private pnlP1, pnlP2, pnlP3 As Panel
Private rctP1, rctP2, rctP3 As Rect
Private cvsActivity, cvsGraph As Canvas
End Sub
Sub Activity_Create(FirstTime As Boolean)
...
cvsActivity.Initialize(Activity) ' initialize the Canvas for the activity
...
pnlP1.Initialize("pnlP1")
Activity.AddView(pnlP1, 0, 14%y, 100%x, 28%y)
cvsGraph.Initialize(pnlP1)
rctP1.Initialize(0, 0, pnlP1.Width, pnlP1.Height)
cvsGraph.drawRect(rctP1, Colors.Transparent, True, 0)
pnlP1.Invalidate
...
End Sub
Public Sub MessageFromDevice(msg As String)
...
'Data held in three arrays P1data etc and position pointed to by P1x etc
cvsGraph.Initialize(pnlP1) ' initialize the Canvas for the panel
cvsGraph.DrawLine(P1x-1, 150+P1data(P1x-1)/10, P1x, 150+P1data(P1x)/10, Colors.black, 1dip)
pnlP1.Invalidate
P1x = P1x+1
If P1x > 1000 Then 'Clear screen
cvsGraph.drawRect(rctP1, Colors.LightGray, True, 0)
pnlP1.Invalidate
P1x = 1
End If
...
End Sub