启用视觉样式后我可以覆盖控件的颜色吗?
我在 C++ Builder 2010 中有一个应用程序,启用了视觉样式/运行时主题以使用按钮和选项卡的运行时外观。但是,如果可能的话,我有一组复选框(TCheckBox),我想覆盖它们的运行时样式。
我的复选框用于切换一些图形叠加层的各种颜色。当我禁用运行时主题时,我可以设置复选框的背景以显示它将启用哪种颜色,如下所示:
有没有办法在启用运行时主题时实现相同的效果?
感谢 stukelly,我可以有选择地禁用各个控件的视觉样式,但在调用 SetWindowTheme 后,我似乎无法修改该控件的颜色或其他样式,如下所示:
SetWindowTheme(CheckBox1->Handle, L" ", "");
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:
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" ", "");
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试使用 禁用每个复选框的主题SetWindowTheme函数。
我不确定第二个参数是否需要为
NULL
或L" "
如文档所述。我使用以下参考资料来回答这个问题。
http://www.delphigroups.info/3/7/54654.html
borland.public.delphi.ide.general
You could try disabling the theme for each checkbox using the SetWindowTheme function.
I'm not sure if the second parameter needs to be
NULL
orL" "
as the documentation mentions.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.