 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Andreas Amann Guest
|
Posted: Wed Feb 16, 2005 2:48 pm Post subject: Dynamic PaintBox |
|
|
hello,
I try to create a Paintbox into a scrollbox. And I I try to draw a
rectangle. the problem is, that nothing is visible.
ähmm, and i use C++builder, but i think the components are the same.
Thx
TPaintBox *PaintBox1 =new TPaintBox(this);
PaintBox1->Parent = ScrollBox1;
PaintBox1->Left = 100;
PaintBox1->Top = 100;
PaintBox1->Height = 300;
PaintBox1->Width = 300;
PaintBox1->Canvas->Rectangle(5, 0, 50, 50);
|
|
| Back to top |
|
 |
Heinrich Wolf Guest
|
Posted: Wed Feb 16, 2005 3:23 pm Post subject: Re: Dynamic PaintBox |
|
|
Do you paint the rectangle on each FormPaint event?
You can refresh the rectangle without handling FormPaint,
if you replace tPaintBox by tImage.
Do you call Application->ProcessMessages()
between painting the rectangle and viewing it?
|
|
| Back to top |
|
 |
Mitch Guest
|
Posted: Wed Feb 16, 2005 3:49 pm Post subject: Re: Dynamic PaintBox |
|
|
Andreas Amann wrote:
| Quote: | hello,
I try to create a Paintbox into a scrollbox. And I I try to draw a
rectangle. the problem is, that nothing is visible.
ähmm, and i use C++builder, but i think the components are the same.
Thx
TPaintBox *PaintBox1 =new TPaintBox(this);
PaintBox1->Parent = ScrollBox1;
PaintBox1->Left = 100;
PaintBox1->Top = 100;
PaintBox1->Height = 300;
PaintBox1->Width = 300;
PaintBox1->Canvas->Rectangle(5, 0, 50, 50);
A Paintbox doesn't "store" any of the graphics like an Image control it |
only support a Canvas (Window's drawing context, HDC) that you draw to
in the OnPaint event. Every time the paintbox needs to be refreshed your
OnPaint drawing will be executed.
Mitch Wolberg,
RockWare, Inc.
|
|
| Back to top |
|
 |
Paul Nicholls Guest
|
Posted: Wed Feb 16, 2005 10:18 pm Post subject: Re: Dynamic PaintBox |
|
|
"Mitch" <mitch.ABB (AT) rockware (DOT) com> wrote
| Quote: | Andreas Amann wrote:
hello,
I try to create a Paintbox into a scrollbox. And I I try to draw a
rectangle. the problem is, that nothing is visible.
ähmm, and i use C++builder, but i think the components are the same.
Thx
TPaintBox *PaintBox1 =new TPaintBox(this);
PaintBox1->Parent = ScrollBox1;
PaintBox1->Left = 100;
PaintBox1->Top = 100;
PaintBox1->Height = 300;
PaintBox1->Width = 300;
PaintBox1->Canvas->Rectangle(5, 0, 50, 50);
A Paintbox doesn't "store" any of the graphics like an Image control it
only support a Canvas (Window's drawing context, HDC) that you draw to in
the OnPaint event. Every time the paintbox needs to be refreshed your
OnPaint drawing will be executed.
Mitch Wolberg,
RockWare, Inc.
|
Also don't forget to set the PainBox1.Visible to true...
Paul.
|
|
| 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
|
|