How do I eliminate graph flicker?

a.p.gumby

Member
Joined
Dec 5, 2006
Messages
5
Programming Experience
10+
Hi,
I am developing my first Windows CE application using VB.Net.
I am plotting a graph in a panel using the following code

VB.NET:
Private Sub panGraph_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles panGraph.Paint
Dim upperBound As Integer = yValues.Count - 1
Dim penGreen As Pen = New Pen(Color.Green)
Dim penRed As Pen = New Pen(Color.Red)
Dim penBlack As Pen = New Pen(Color.Black)
If upperBound > 0 Then
Dim points(upperBound) As Point
'Create the points.
For i As Integer = 0 To upperBound Step 1
'Draw the points.
points(i) = New Point(i, yValues(i))
Next i
'Draw the points connected by a line.
e.Graphics.DrawLines(penGreen, points)
'Draw the axes.
e.Graphics.DrawLine(penBlack, 0, panGraph.Height - 1, panGraph.Width, panGraph.Height - 1)
e.Graphics.DrawLine(penBlack, 0, panGraph.Height, 0, 0)
End If

Unfortunately, the graph flickers.

I have found suggestions that I should use double buffering to eliminate this but am unsure how to do this.

Any help appreciated.
 
So, I have been doing some digging and it looks like I need to do some double buffering:confused:
I have found an MSDN article that shows the form paint event being overidden.
How do I override a panel paint event.
Any help appreciated.
 
Back
Top