This is a follow-up to my earlier question Draw Custom Buttons on Windows Vista/7 Aero Titlebar.
I revisited the topic quite recently and found this article which is essentially a hack to 'drawing' buttons on Aero-enabled title bar (Windows Vista & 7). What the code does is to create a transparent window over the current one and places the buttons on it, giving the impression of additional buttons on the title bar. The only problem is the buttons look like regular WinForms buttons!
My question is, how do I read the windows shell style (aka theme) in order to create buttons styled just like those in the Control Box (see image)?
I'd like answers to be in .NET (VB.NET or C#). I'm okay with unmanaged code.
So if I understand you correctly, you want to read what Windows 7 calls the "Window Color" aspect of the current theme.
Acording to MSDN http://msdn.microsoft.com/en-us/magazine/cc163435.aspx, you want DwmGetColorizationColor: "retrieves the current color that is being used for DWM glass composition. This value is based on the current color scheme. Changing the setting causes a WM_WMCOLORIZATIONCOLORCHANGED notification."
[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern void DwmGetColorizationColor(out int pcrColorization, [MarshalAs(UnmanagedType.Bool)]out bool pfOpaqueBlend);
"You can check to see the composition color and opacity by calling the DwmGetColorizationColor function. If this function succeeds, it will set a GDI+ ARGB color value and a Boolean indicating whether the color is opaque. Just like changing the Aero scheme in the control panel, there's a message broadcast when the composition color has changed. WM_DWMCOLORIZATIONCOLORCHANGED is sent when this happens, but in this case the parameters tell you what the new color and opacity are."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With