获取航空窗口颜色 [英] Get Aero Window Colour

查看:110
本文介绍了获取航空窗口颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用WPF做了一个非常漂亮的Windows 8十岁上下的接口。它已经变成了更好的方式比我求之不得,但我想知道以下内容:

I've made a pretty slick Windows 8-ish interface using WPF. It already turns out way better than I could wish for, but I was wondering the following:

时,它在某种程度上可以检索当前窗口的颜色由用户设置?你知道,你可以设置Aero配色时用鼠标右键单击桌面......我的计划是使用该颜色的一对夫妇对我的GUI的画布元素。

Is it somehow possible to retrieve the current window colour set by the user? You know, you can set the Aero colour when you right-click the desktop... My plan is to use that colour for a couple of canvas elements on my GUI.

提前感谢!

推荐答案

您可以查询这个ColorizationColor注册表项。

You can query the ColorizationColor registry key for this.

我甚至更进一步,创造一个方法来获得十六进制颜色值,希望这可以帮助你:

I've even went a step further and created a method to get the hexadecimal colour value, hope this helps you:

public void SomeMethod()
{
    int argbColor = (int)Microsoft.Win32.Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM","ColorizationColor", null);
    var color = System.Drawing.Color.FromArgb(argbColor);
    string hexadecimalColor = ConverterToHex(color);
}


private static String ConverterToHex(System.Drawing.Color c)
{
    return String.Format("#{0}{1}{2}", c.R.ToString("X2"), c.G.ToString("X2"), c.B.ToString("X2"));
}

这篇关于获取航空窗口颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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