On Sun, 10 Jun 2007 17:43:15 -0700, <ct*****@gmail. comwrote:
I read all you guys reply (Thanks..)
But I still dont know how to maintain something drawed.
I'm not clear on why not, as it seems to me that the question was answered
correctly and more than once.
That said...
What I'm doing is realtime updating which is updated in a unit of
every 0.5~1 secs and the updating is a lot...
Updating every half second to second is child's play for a modern
computer, even when including a _lot_ of information in the update.
It's possible to keep a lot drawing information in a array, but i
don't know performance.. (Actually I do not want to keep the data..)
If you do not want to keep the data, then why do you want to keep
displaying it?
Something to keep in mind: if it is taking you so long to draw everything
you want from scratch, then it is likely that you are drawing more
information to the screen than any human user will be able to comprehend..
Conversely, if you have a mechanism in mind for "aging" the information
and throwing out old information, then you can apply that to stored data
as well as you can to a cached bitmap (better than, actually).
After update something, I want to remove the information in every class..
So, do that. No one said you had to save ALL of the information you ever
receive. You just have to save the information that will be important the
next time Windows asks you to redraw your form.
Somebody tell me the OS system or Video card remember drawing
information in a cache or somewhere, So I do not need to keep that but
I don't know how to do it...
Somebody tell you? If anyone told you that what you draw once is
automatically saved for you, they were wrong. That's just not part of the
standard Windows screen updating paradigm (nor of most other GUI operating
systems for that matter).
Does any body show me the short sample code.
Please help me.... . ;;;;
Here is some short code that should give you the idea:
private Bitmap _bmpCache;
void UpdatedData()
{
Graphics gfx = Graphics.FromIm age(_bmpCache);
// use gfx Graphics instance to draw whatever you want to draw
}
protected override void OnPaint(object sender, PaintEventArgs e)
{
e.Graphics.Draw Image(_bmpCache , 0, 0);
}
You need to make sure that _bmpCache is initialized to a Bitmap the
correct size for your form (or at least, the size you expect to draw to)..
You will need to clear the bitmap manually any time you think that is
appropriate, because everything you draw will just keep piling up in the
bitmap otherwise.
Hope that helps.
Pete