tags:

views:

36

answers:

1

I draw a drawing on a custom panel using GDI+. Somethink like: alt text

Now, I can override 2 methods: OnPaint() and OnPaintBackground().

Say I draw the grid in background and the graph in OnPaint, or draw the texts in background and lines in Paint.

Is it more optimal to divide the work between Background and Paint or to draw everything in OnPaint?

PS.
By the way, is it possible Stopwatch to determine it? I mean don't know when to start/stop it...

+2  A: 

I think either method is ok, if you do not use double-buffering. If using double-buffering, do everything in OnPaint.

leppie
I use DoubleBuffering, so maybe I should not use it. this from one part, from other, for drawing I use the Matrix.Transform (zoom) for drawing texts I should not use zoom, but recalculate coordinates manually, so I thought texts I can draw on background... but if does not brings performance, maybe is no need to use background...
serhio
Try both. IIRC there are issues using the background with double buffering.
leppie