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 

TCustomControl color problem

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





PostPosted: Fri Mar 03, 2006 9:03 am    Post subject: TCustomControl color problem Reply with quote



Using BDS2006 on XP w/ themeing enabled.

I have a custom control that derives from TCustomControl. This control can
contain (parent) other controls, similar to a TPanel for example.

I place my custom control on a TScrollBox. My control has its color set to
some color, say clBlue for example, while the TScrollBox is set to
clBtnFace.

I drop a TPanel on my control and set its color to, say, clRed. In design
time, everything looks exactly as it should. At run time, the TPanel ALWAYS
draws itself using the color of the TScrollBox! Event if I set ParentColor
to true, it still draws the color of the custom control's parent, rather
than the color assigned to it. The same holds true for other controls
dropped on to my control that have transparant parts, like a TCheckBox. The
background is ALWAYS drawn in the color of the TScrollBox instead of the
color of my custom control. I have tried setting csOpaque in the
ControlStyle, with no change.
I also get the same results if I put my component directly on a form.
Controls that it contains paint themselves using the form's color instead of
my component's. What am I doing wrong?

Mark
Back to top
Clayton Arends
Guest





PostPosted: Fri Mar 03, 2006 5:03 pm    Post subject: Re: TCustomControl color problem Reply with quote



What you describe is not default behavior so perhaps posting your code might
shed some light.

- Clayton
Back to top
Mark Guerrieri
Guest





PostPosted: Fri Mar 03, 2006 6:03 pm    Post subject: Re: TCustomControl color problem Reply with quote



Quote:
What you describe is not default behavior so perhaps posting your code
might shed some light.

I figured it out- it had to do with ParentBackground defaulting to true,
which was causing my control to paint its background using its parent
background when contained controls requested a background repaint.

Mark
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.