@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: SetUserColorPreference will set the current theme Accent color and the Start menu color through uint numbers representing colors inside the IMMERSIVE_COLOR_PREFERENCE structure !!!!C# Signature: [DllImport("uxtheme", EntryPoint = "#122")] static extern int SetUserColorPreference(ref IMMERSIVE_COLOR_PREFERENCE pcpPreference, bool fForceSetting); !!!!VB Signature: Declare Function SetUserColorPreference Lib "uxtheme.dll" (TODO) As TODO !!!!User-Defined Types: [StructLayout(LayoutKind.Sequential)] private struct IMMERSIVE_COLOR_PREFERENCE { public uint dwColorSetIndex; public uint crStartColor; public uint crAccentColor; } !!!!Notes: None for now !!!!Tips & Tricks: //To convert Colors from their UINT form to the managed Color class and vice versa: private static uint ToUint(Color c) { return (uint)((c.B << 16) | (c.G << 8) | c.R); } private static Color ToColor(uint c) { int R = (int)(c & 0xFF) % 256; int G = (int)((c >> 8) & 0xFFFF) % 256; int B = (int)(c >> 16) % 256; return Color.FromArgb(R, G, B); } !!!!Sample Code: [DllImport("uxtheme", EntryPoint = "#122")] static extern int SetUserColorPreference(ref IMMERSIVE_COLOR_PREFERENCE pcpPreference, bool fForceSetting); private static uint ToUint(Color c) { return (uint)((c.B << 16) | (c.G << 8) | c.R); } [StructLayout(LayoutKind.Sequential)] private struct IMMERSIVE_COLOR_PREFERENCE { public uint dwColorSetIndex; public uint crStartColor; public uint crAccentColor; } private void SetAccentColor(Color c) { IMMERSIVE_COLOR_PREFERENCE temp = new IMMERSIVE_COLOR_PREFERENCE { crAccentColor = ToUint(c), dwColorSetIndex = 0, crStartColor = ToUint(c) }; SetUserColorPreference(ref temp, true); } Documentation: there's no documentation on this function. Found it through C++ repositories and translated code from https://github.com/m417z/Windows-10-Color-Control
Edit uxtheme.SetUserCo...
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.