Get Aero Window Colour

前端 未结 4 961
离开以前
离开以前 2020-12-18 11:40

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:

Is it somehow

4条回答
  •  天涯浪人
    2020-12-18 12:19

    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"));
    }
    

提交回复
热议问题