开发者

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 runt开发者_StackOverflow社区ime 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:

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

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" ", ""); 


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜