 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Ney André de Mello Zunino Guest
|
Posted: Mon Oct 17, 2005 7:49 pm Post subject: TCanvas and repainting |
|
|
Hello.
In an application, I create a TCanvas object and associate its handle
with a containing panel of my main form. I am able to draw on the
canvas, using its drawing API. However, I have been having lots of
repaint issues, where the drawing on the canvas will get painted over,
as if some other handler were causing the white background to be painted
again. This happens, for instance, when I resize the main form.
To tell the truth, I am not exactly sure of what is going on. What I
seek to have is a painting area which should be redrawn everytime
something covers and then exposes it and also when the containing panel
is resized (i.e. when the main window is resized).
What is the correct/proper way to set up a TCanvas on a TPanel and have
it handle its drawing in a way that will not interfere with the other
components' regular drawing and at the same time have the least
overhead? Is there a set of best practices or a sort of guide with
regards to this?
Thank you very much,
--
Ney André de Mello Zunino
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Mon Oct 17, 2005 8:56 pm Post subject: Re: TCanvas and repainting |
|
|
"Ney André de Mello Zunino" <zunino (AT) inf (DOT) ufsc.br> wrote
| Quote: | In an application, I create a TCanvas object and associate its handle
with a containing panel of my main form. I am able to draw on the
canvas, using its drawing API. However, I have been having lots of
repaint issues, where the drawing on the canvas will get painted over,
as if some other handler were causing the white background to be
painted again. This happens, for instance, when I resize the main form.
|
Drawing is a recurring operation. You can't just draw once and expect the
drawing to remain forever. You have to re-draw every time the control needs
to be refreshed by the OS. That means responding to the WM_PAINT or similar
message. It sounds like you are not currently doing that.
| Quote: | What I seek to have is a painting area which should be redrawn
everytime something covers and then exposes it and also when the
containing panel is resized (i.e. when the main window is resized).
|
Look at TPaintBox. It has a OnPaint event. If you must continue using a
panel, then you will have to subclass its WindowProc property, or derive a
new class, in order to manage the re-painting.
Gambit
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|