BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Dynamic PaintBox

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics
View previous topic :: View next topic  
Author Message
Andreas Amann
Guest





PostPosted: Wed Feb 16, 2005 2:48 pm    Post subject: Dynamic PaintBox Reply with 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);
Back to top
Heinrich Wolf
Guest





PostPosted: Wed Feb 16, 2005 3:23 pm    Post subject: Re: Dynamic PaintBox Reply with quote



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





PostPosted: Wed Feb 16, 2005 3:49 pm    Post subject: Re: Dynamic PaintBox Reply with quote



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





PostPosted: Wed Feb 16, 2005 10:18 pm    Post subject: Re: Dynamic PaintBox Reply with quote

"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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.