I have a drawingarea 900 pixels wide (and 20 pixels high) and a timer that triggers every 5 seconds. Every time the timer trigger it checks the status of three radiobuttons and make a vertical line in the drawingarea with grey, red or green color depending on which radiobutton that is active. It's like a progressbar but with the possibility to see the status of the radiobuttons over time.
The problem is that when I do the drawingarea.refresh it erases the previous lines.
The code:
Public StatusValue1 As Byte
Public Sub DrawingArea1_Draw()
Select Case StatusValue1
Case 0
Paint.Brush = Paint.Color(Color.LightGray)
Case 1
Paint.Brush = Paint.Color(Color.Red)
Case 2
Paint.Brush = Paint.Color(Color.Green)
End Select
Paint.LineWidth = 1
Paint.MoveTo(CInt(Timer), 0)
Paint.LineTo(CInt(Timer), 20)
Paint.Stroke
End
Public Sub Timer1_Timer()
StatusValue1 = 0
If RadioButton2.Value = True Then
StatusValue1 = 1
Else
If RadioButton3.Value = True Then
StatusValue1 = 2
Endif
Endif
DrawingArea1.Refresh
End
The Drawingarea.cached is false (if it's true the drawingarea_draw-event will not trigger).
I admit that my knowledge and experience of graphics and the drawingarea functions is very slim. Can anyone point out what I'm doing wrong or have a link to an example?