从当前设置的Windows主题获取主题颜色(和其他资源) [英] Gettting theme colors (and other resources) from currently set Windows Theme

查看:127
本文介绍了从当前设置的Windows主题获取主题颜色(和其他资源)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.我真的回到了自定义Windows窗体的非客户区域的角度,我希望能够从当前使用的Windows主题中获取资源(例如位图和颜色).我找到了一个UxTheme包装器,但是它并不能完全满足我的需要.我将以Mozilla Firefox为例.

这就是打开Windows Aero主题的Firefox的样子: http://i49.tinypic.com/2rh4s4m.jpg [ ^ ]

这就是使用Windows 7 Basic主题的Firefox的外观: http://i45.tinypic.com/2dcj32u.jpg [ ^ ]

最后,这就是带有Windows Classic主题的Firefox的外观: http://i46.tinypic.com/2vkylc4.jpg [ ^ ]

那么Firefox如何从Basic主题中获取颜色,以便可以将其扩展"到客户端"区域中?如果在启用Windows Classic主题的情况下最大化Firefox,它将以渐变的形式向工具栏的开头绘制标题.

Hey everyone. I have really gotten back into customizing the non client area of windows forms, and I want to be able to get resources (such as bitmaps, and colors) from the currently used windows theme. I found an UxTheme wrapper, but it doesn''t quite do what I need it to do. I will use Mozilla Firefox as an example.

This is what Firefox looks like with Windows Aero theme turned on :http://i49.tinypic.com/2rh4s4m.jpg[^]

And this is what Firefox looks like with Windows 7 Basic theme on: http://i45.tinypic.com/2dcj32u.jpg[^]

And finally, this is what Firefox looks like with Windows Classic theme on: http://i46.tinypic.com/2vkylc4.jpg[^]

So how does Firefox get the colors from the Basic theme so that it can be "extended" into the Client area? If you maximize Firefox with the Windows Classic theme on, it will draw the caption with a gradient going toward the beginning of the toolbar.

Any sort of answer will be greatly appreciated!

推荐答案

大多数都是自动的.您可以在 Windows Vista Aero Glass中获得此信息. NET托管的Win32应用程序 [
Most of it is automatic. You can get this info here Windows Vista Aero Glass in .NET Managed Win32 Applications[^]

Basically, the method calls DwmIsCompositionEnabled and if it returns false, then Firefox probably has code that changes the background of (what we could say) the tabs control to whatever color they want to match.

By the way, you probably already can infer but the DwmIsCompositionEnabled determines if Windows Aero is on or off.


这篇关于从当前设置的Windows主题获取主题颜色(和其他资源)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆