简体   繁体   English

SWT:检测操作系统主题更改

[英]SWT: Detect OS theme change

In SWT, I have customized the look of my CTabFolder to match the system colors, in this case using SWT.COLOR_TITLE_BACKGROUND and SWT.COLOR_TITLE_FOREGROUND. 在SWT中,我定制了CTabFolder的外观以匹配系统颜色,在本例中使用SWT.COLOR_TITLE_BACKGROUND和SWT.COLOR_TITLE_FOREGROUND。 The problem is that when the user changes the OS colors (for example by switching from the Windows Classic theme to some other theme), the CTabFolder retains the old colors. 问题是当用户更改操作系统颜色时(例如,通过从Windows经典主题切换到其他主题),CTabFolder会保留旧颜色。

So my question is: Does anybody know how to receive notification when the system colors and/or the OS theme changes? 所以我的问题是:当系统颜色和/或操作系统主题发生变化时,有人知道如何接收通知吗? (Regularly polling the system colors is something I'd like to avoid.) (定期轮询系统颜色是我想避免的。)

您可以向Display for SWT.Settings添加一个监听器:

display.addListener(SWT.Settings, yourListener);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM