Get Aero Window Colour

前端 未结 4 963
离开以前
离开以前 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:13

    I managed to get the correct colour using the following code: Little sidenote: It has a small correction in it to ignore the alpha bit of the hex number, so I get the full color rather than the less saturated one.

    string colorizationValue = string.Format("{0:x}", Microsoft.Win32.Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM", "ColorizationColor", "00000000"));
    StringBuilder bl = new StringBuilder(colorizationValue);
    bl[0] = 'd';
    bl[1] = '9';
    colorizationValue = bl.ToString();
    
    BrushConverter bc = new BrushConverter();
    Brush brush = (Brush)bc.ConvertFrom("#" + colorizationValue);
    cvs_barColor.Background = brush;
    

提交回复
热议问题