|
|
|
date: Mon, 30 Jun 2008 23:24:00 -0700,
group: microsoft.public.win32.programmer.gdi
back
Re: GDI: 2D Graph Project realted questions
There is exactly one place you are allowed to draw on the surface if you expect it to
persist, and that is in OnPaint. Any drawing done outside OnPaint will not persist, and
essentially represents erroneous programming.
You draw EVERYTHING in the OnPaint handler, so there is no "best time"; it is always part
of the one-and-only drawing event. Generally, most attempts to "optimize" performance
will reduce it, because GDI is better at clipping than an application can be.
What you do is create a data structure of some sort that, when processed, will create your
graph. Typically, it is just the array of x,y points to plot. But the only place you
draw them is in OnPaint. Where you draw the axes. If you add a point, you typically only
have to invalidate the area in which it will be drawn.
But if you are not drawing in OnPaint, you need to study carefully how proper graphics are
done in Windows.
joe
On Mon, 30 Jun 2008 23:24:00 -0700, deostroll wrote:
>There are several question I'd like to ask:
>
>1. How do I persist the drawing on the form? When I move the window, or
>minimize it, etc the image disappears
>2. When is the best time I can draw the axes (the x-axis, y-axis)
>
>These are the questions I can think of right now. I know I may have more.
>
>--deostroll
date: Thu, 31 Jul 2008 04:49:57 -0400
author: Joseph M. Newcomer
|
|