Problem drawing graphs


im programming an app that draws on screen several plots. The problem is that every time the window is hiden and showed again, OnDraw()is called and the window is repainted, so my graph dissapears. I cannot allow Ondraw call the ploting function whenever the window need to be repainted, because the graphs need of hard signal procesing.

My question is if there is any method to save the current state of the window, so each call to ondraw() or othe function i write, will paint what i want?

If not, how can i prevent the window to be repainted each time ondraw is called?

thanks in advance.
Who is Participating?
ZoppoConnect With a Mentor Commented:
Hi pergaminus,

I would suggest that you implement the drawing in a way that
it doesn't draw to screen but to some kind of internal buffer,
i.e. a bitmap through a memory device context or a metafile.

Then, in OnDraw simply draw the bitmap or metafile to the
screen ...

Whenever the graph changes you simply need to redraw the window
after the internal drawing is done.

All drawing code should be in OnDraw function (or called from it). You can prevent window redrawing on OnDraw function, but in this case you will get an empty window.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.