Troyen
Troyen

Reputation: 1428

Can I override the color of a control when Visual Styles are enabled?

I have an application in C++ Builder 2010 that has Visual Styles/Runtime Themes enabled to use the runtime look for buttons and tabs. However, I have a set of checkboxes (TCheckBox) for which I would like to override the runtime style, if possible.

My checkboxes are used to toggle some graphical overlays for various colors. When I have runtime themes disabled, I can set the background of the checkbox to show which color it will enable, like so: checkboxes with a custom background color

Is there a way I can achieve this same effect when runtime themes are enabled?

Thanks to stukelly, I can selectively disable visual styles for individual controls, but I seem unable to modify the color or other styling of that control after I call SetWindowTheme as below:

SetWindowTheme(CheckBox1->Handle, L" ", ""); 

Upvotes: 2

Views: 2075

Answers (2)

Brian
Brian

Reputation: 7289

Put each checkbox on it's own panel and set it to the color you want.

Upvotes: 1

stukelly
stukelly

Reputation: 4307

You could try disabling the theme for each checkbox using the SetWindowTheme function.

  SetWindowTheme(CheckBox1->Handle, NULL, ""); 

I'm not sure if the second parameter needs to be NULL or L" " as the documentation mentions.

  SetWindowTheme(CheckBox1->Handle, L" ", ""); 

I used the following references to answer this question.
http://www.delphigroups.info/3/7/54654.html
borland.public.delphi.ide.general

Upvotes: 3

Related Questions