 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Sabetay Toros Guest
|
Posted: Wed Dec 17, 2003 8:28 pm Post subject: Painting unseen windowed controls |
|
|
Hi,
I've derived a new class from TCustomControl. The class has 2D grahpics
functionality like Zoom & Scroll and also can own several controls. When
Zoom All event occurs, the class can paint the window and all the
controls that it owns. In ZoomIn event it can only paint the portion that is
zoomed as expected with the controls that owns. But when Scroll Event Occurs
the unpainted portion of the window get painted without owned windowed
controls even if I itarate the windows Controls one by one and send WM_PAINT
messages. The problem may be occures by not sending this message to the
controls properly. I'm sending this message as the following
Controls[i]->Perform(WM_PAINT,NULL,NULL);
or the system is ignoring it just because the system is thinking that it is
already painted. I'm missing something. Because I resolve this problem by
changing the controls Left and Top property. This properties is imposing to
paint the control it self. How? Any ideas,
Thanks
Sabetay
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Wed Dec 17, 2003 9:01 pm Post subject: Re: Painting unseen windowed controls |
|
|
"Sabetay Toros" <bilsarbiz (AT) ttnet (DOT) net.tr> wrote
| Quote: | Controls[i]->Perform(WM_PAINT,NULL,NULL);
|
You are not specifying any parameters to WM_PAINT. It does, in fact, take a
parameter - the WParam value should be a valid HDC that the control will
actually paint itself to. Your best bet wold be to maintain an offscreen
bitmap in memory, passing its HDC when you issue WM_PAINT. Then, whenever
you need to draw your main component, just render what is available in the
bitmap instead. That will then alow you to do whatever operations you need
to perform, such as sizing and scrolling.
Gambit
|
|
| Back to top |
|
 |
Sabetay Toros Guest
|
Posted: Wed Dec 17, 2003 10:43 pm Post subject: Re: Painting unseen windowed controls |
|
|
Remy,
Thank you for your clear answers. If you visit to Turkey in the near future
let me know you have a friend and just be my guest.
| Quote: | You are not specifying any parameters to WM_PAINT. It does, in fact, take
a
parameter - the WParam value should be a valid HDC that the control will
actually paint itself to.
|
You're wright. I read the help file and give a try like
Controls[i]->Perform(WM_PAINT, (long) Canvas->Handle, NULL);
But it doesn't change anything. The control does not paint itself. I am
probably sending a wrong parameter. Could you suggest anything ?
| Quote: | Your best bet wold be to maintain an offscreen
bitmap in memory, passing its HDC when you issue WM_PAINT. Then, whenever
you need to draw your main component, just render what is available in the
bitmap instead. That will then alow you to do whatever operations you
need
to perform, such as sizing and scrolling.
|
I can not understand what you are saying. This is very abstract for me and
my knowledge is beyond of it . Could you give some code example. And
besides even if I might be able to render the bitmap would the control be
alive? The control must give response to the events like OnClick etc.
Thank you very much for your contrubitons,
Best Regards
Sabetay
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Thu Dec 18, 2003 12:16 am Post subject: Re: Painting unseen windowed controls |
|
|
"Sabetay Toros" <bilsarbiz (AT) ttnet (DOT) net.tr> wrote
| Quote: | But it doesn't change anything. The control does not paint itself.
I am probably sending a wrong parameter. Could you suggest anything ?
|
Please show a more complete example of your actual code.
| Quote: | And besides even if I might be able to render the bitmap would
the control be alive?
|
To be honest, I do not believe you will ever be able to accomplish what you
are asking for using live controls, simply because Windows does not suport
zooming actual windows. You may just have to forget allowing the component
to own separate controls, and instead just draw the main component to look
like it is containing controls, which are actually nothing more then drawn
images, and use hit-testing and such to detect when the user is trying to
click on a "control" and perform the necessary updates to display its new
"state", if needed.
What EXACTLY are you trying to accomplish with this component? Please
explain in more detail.
Gambit
|
|
| Back to top |
|
 |
Eugene Mayevski [SecureBl Guest
|
Posted: Thu Dec 18, 2003 12:22 am Post subject: Re: Painting unseen windowed controls |
|
|
Sabetay Toros wrote:
| Quote: | You're wright. I read the help file and give a try like
Controls[i]->Perform(WM_PAINT, (long) Canvas->Handle, NULL);
But it doesn't change anything. The control does not paint itself. I am
probably sending a wrong parameter. Could you suggest anything ?
|
I am not sure if this is the case, but I came across the very nasty
feature of Windows - for some controls WM_PAINT doesn't work if the
control is not actually visible on the screen. Maybe this is what's
going on. If it is, you can try using WM_PRINTCLIENT message. It was
designed for goals similar to yours.
--
Eugene Mayevski
EldoS Corp., CTO
Security and networking solutions
http://www.eldos.com
|
|
| 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
|
|