活动字幕文本颜色 - 检测更改(在.Net中) [英] Active Caption Text Color — detect change (in .Net)
问题描述
在Vista上,启用Aero后,正常模式下的窗口标题为黑色(写在轻微的玻璃上),而在最大化时,标题为白色(写在黑色玻璃上)。
On Vista, with Aero enabled, the window's title in normal mode has text in black (written over a slightly light glass) while when maximized the title is in white (written over a dark glass).
如何确定窗口标题的当前颜色?
How can I determine the current color of the window title ?
PS我写了一个程序来观察 SystemColors.ActiveCaptionTextColor
后,但在两种模式下保持不变。
P.S. I wrote a program to watch after SystemColors.ActiveCaptionTextColor
, but it remains the same in two modes.
推荐答案
我不能让VisualStyleRenderer告诉我任何东西。
i can't make VisualStyleRenderer tell me anything either.
您可以选择:
- VisualStyleElement.Window.Caption.Active
- VisualStyleElement.Window.MaxCaption.Active
因为 MaxCaption 为最大化窗口的标题栏的每个状态提供了VisualStyleElement对象。
Because MaxCaption provides VisualStyleElement objects for each state of the title bar of a maximized window.
除了它实际上不工作。如果您要求活动最大化窗口的字幕文本颜色:
Except it doesn't actually work. If you ask for the caption text color of an active maximized window:
VisualStyleRenderer renderer =
new VisualStyleRenderer(VisualStyleElement.Window.MaxCaption.Active);
Color c = renderer.GetColor(ColorProperty.TextColor);
字幕会返回黑色和 MaxCaption 。
事实上,几乎所有的颜色在两者之间是相同的:
In fact, almost all colors are the same between the two:
我的猜测是没有办法让你的应用程序具有相同的外观,感觉为操作系统。
My guess is that there's no way to make your application have the same look and feel as the operating system.
这篇关于活动字幕文本颜色 - 检测更改(在.Net中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!