Problem drawing graphs

Posted on 2003-03-24
Medium Priority
Last Modified: 2013-11-20

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.
Question by:pergaminus
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 48

Expert Comment

ID: 8200743
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.
LVL 31

Accepted Solution

Zoppo earned 225 total points
ID: 8201271
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.


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question