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 

Give me a hint on how optimeze or write better...

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development)
View previous topic :: View next topic  
Author Message
Manuel Elko
Guest





PostPosted: Wed Aug 18, 2004 6:07 am    Post subject: Give me a hint on how optimeze or write better... Reply with quote



Hi 2 U all first of ALL!

Well, a problem rised in me 2 days ago!

Let me explain U:

I Know that a class derived from TGtraphicControl need the PAINT
method to be redefined to allow right working.....

So I've got a Paint. The problem is that my CONTROL goes on updating
time to time datas that must be painted, but not all datas need to be
repainted, but i need persistency of objects and datas on the
screen....

So, to be faster, and not to Repaint (paint) everything, how can i
implement a fine way to find the solution to this problem?

thank'a.

Back to top
DialTone
Guest





PostPosted: Wed Aug 18, 2004 8:59 pm    Post subject: Re: Give me a hint on how optimeze or write better... Reply with quote



Quote:
So, to be faster, and not to Repaint (paint) everything, how can i
implement a fine way to find the solution to this problem?

thank'a.



Not sure I totally understand, but I think what you need is to be
checking ClipRect to determine what needs to be repainted.

Assuming you have a class which has a property called "BackDrop" which is
an instantiated TImage, then you could draw the image onto your class
like this...

procedure TMyControl.Paint;
begin
if (BackDrop.Canvas <> nil) then
Canvas.CopyRect(Canvas.ClipRect, BackDrop.Canvas,
Canvas.ClipRect)
else begin
Canvas.Brush.Color:=clBtnFace;
Canvas.Brush.Style:=bsSolid;
Canvas.FillRect(Canvas.ClipRect);
end;
end;


Also, setting the ControlStyle in the constructor...

constructor TMyControl.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
ControlStyle:=[csCaptureMouse, csClickEvents, csSetCaption,
csDoubleClicks, csOpaque];
end;

Can also help (it's the csOpaque that is important) - this tells VCL that
the control fills its rectangle, so it doesn't bother to try to redraw
controls beneath your control (so you get no flickering)

Not sure if that helps?
Tony

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development) 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.