tags:

views:

17

answers:

1

I have a drawing graph on a panel. The drawing has 2 components: "background" Grid and "foreground" graph. The user can move the graph lines, but the background remains static (for a selected time interval).

Re-drawing the background is a little expensive. Is there a way to keep the background "intact" and redraw the "foreground" graph only when moving the graph lines?

+1  A: 

You could draw the background on a bitmap (acting as a buffer), and then just 'draw' the image every time.

leppie
so simple, that I even didn't think about...
serhio
however, this flickers... when I draw first the background image, then the graph image on each OnPaint it flickers. Don't you know a way of combining background and foreground images in a image?
serhio
Turn on double-buffering, and do both the background image 'blt' and foreground in 1 operation.
leppie