How to create .NET style header bar buttons.

This is a continuation of my previous question Drawing custom buttons in Windows Vista / 7 Aero Titlebar .

I recently looked through a topic and found in this article which, in fact, is the β€œdraw” button on the Aero title bar (Windows Vista and 7). What the code does is to create a transparent window above the current one and place buttons on it, giving the impression of additional buttons in the title bar. The only problem is that the buttons look like regular WinForms buttons!

My question is: how do I read the Windows shell style (aka theme) to create buttons that are created in the same way as in the Control Box (see image)?

I would like the answers to be in .NET (VB.NET or C #). I'm fine with unmanaged code.

Control buttons

+5
source share
1 answer

So, if you understand correctly, you want to read that Windows 7 invokes the "Window Color" aspect of the current theme.

According to MSDN http://msdn.microsoft.com/en-us/magazine/cc163435.aspx you want DwmGetColorizationColor: "retrieves the current color that is used to compose DWM glass. Based on the current color scheme. Changing the setting causes WM_WMCOLORIZATIONCOLORCHANGED notice.

[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern void DwmGetColorizationColor(out int pcrColorization, [MarshalAs(UnmanagedType.Bool)]out bool pfOpaqueBlend);

" , DwmGetColorizationColor. , GDI + ARGB , , . , Aero , . WM_DWMCOLORIZATIONCOLORCHANGED, , ."

+1

All Articles