In my application, I have a form that I customize using the DwmExtendFrameIntoClientArea DWM API method to increase the height of the Aero Glass header, so that part of my client area of the form is drawn on the Aero frame. To achieve this effect, I also draw a black rectangle on the side of the client area, which is “on top” of the glass frame so that it looks transparent, as many online articles show. This worked very well under Windows Vista / Windows 7, but when I downloaded VS 2010 and used the .NET Framework 4.0 as a framework for building my application, this approach no longer works. The problem is that the black rectangle is visible, i.e. Black is no longer considered transparent when applied to Aero glass. Does anyone know what could be wrong with this and how it can be overcome?
The answer to this question is described here: http://msdn.microsoft.com/en-us/magazine/cc163435.aspx#S6 with solutions for C #.
Excerpt from the linked page (in case the link does not work):
Using glass as the background on your window is a bit complicated. If you render something natural opaque (for example, GDI functions), you will get your item on glass, although sometimes with unexpected results. If you want to actually mix rendering with the glass surface, you need to use functionality that uses the alpha channel of colors, such as GDI +, the Windows Presentation Foundation, or the Windows XP API., GDI 0x00000000, , -. , GDI, , . , , , , . , DWM , .
Using glass as the background on your window is a bit complicated. If you render something natural opaque (for example, GDI functions), you will get your item on glass, although sometimes with unexpected results. If you want to actually mix rendering with the glass surface, you need to use functionality that uses the alpha channel of colors, such as GDI +, the Windows Presentation Foundation, or the Windows XP API.
, GDI 0x00000000, , -. , GDI, , . , , , , . , DWM , .
WinForms:
, . - . , -, . , - .NET Framework 2.0 GDI + . , UseCompatibleTextRendering . false, , .NET Framework, . true, . Application.SetUseCompatibleTextRenderingDefault. Visual Studio® 2005, false . , true, , , .
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(true); // this line fixes an issue Application.Run(new GlassForm()); }
, , , ? , API- interop API PBGRA , , . , , .
( , . , PBGRA, BGR A, true , .)
DWM API. , - - , (+/-) (, ) .