In my application I have a form which I tweak by using the DWM API's method DwmExtendFrameIntoClientArea to extend the height of the Aero Glass Title Bar so that part of my form client area is drawn on the Aero frame. To achieve this effect, I also draw a black rectangle on the part of the client area which is 'over' the glass frame so that it appears transparent, as many online articles suggest. This worked pretty well under Windows Vista/Windows 7 but as I downloaded VS 2010 and used the .NET Framework 4.0 as my trarget framework to build my application, this approach no longer works. The problem is that the black rectangle is visible, i.e. the black color is no longer considered transparent when drawing on Aero glass. Does anyone have an idea what might be wrong with that and how it can be overcome?
相关问题
- How to Debug/Register a Permanent WMI Event Which
- the application was unable to start correctly 0xc0
- IPAddress.[Try]Parse parses 192.168 to 192.0.0.168
- Windows 7: How can I get a list of all Windows use
- How to ask for Administrator privileges in Windows
相关文章
- Looking for documentation on the “right” way to in
- PHP 7 FTP extension is not loaded in Windows 7
- Viewing the Process Tree - tlist/tasklist [closed]
- The module “.dll” was loaded but the entry-point w
- Publish is not transforming web.config?
- Default for generic type? [duplicate]
- Cast List of Anonymous type to List of Dynamic Obj
- node.js and npm has no network access in windows 7
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 is down):
And the solution for WinForms:
Forgive me if this is unhelpful, but is it possible that they've simply changed their colour palette? Quite often it seems that those windows interop type APIs can use PBGRA palettes in addition to their default palette, and it's possible that their default colour-palette may have changed from one framework version to another. It should be simple enough to test whether this is true or not.
(I found a similar problem with rendering hardware cursors, where transparent and black would be confused under certain circumstances. It eventually turned out to be that I was miscalculating the PBGRA so that one of BGR was greater than A, which may be true of your background meant-to-be-transparent-colour.)
There are other complications with using the DWM API method. I'm not entirely sure, but from memory, there is something complicated with setting the new margins - if I recall correctly, they all needed to have the same sign (+ / -) or artifacts (such as your suddenly appearing black background) sometimes appeared.