Monday, September 24, 2012 9:11 AM
I have to write a Dotnet Forms application that renders custom controls into "glass-extended" portions of the window frame.
Taking all informations together, I managed to use DwmExtendFrameIntoClientArea and extended the client area of the main Form by handling WM_NCCALCSIZE and WM_NCHITTEST and using DwmDefWindowProc. All seems to be good, but when maximizing the window using "aero dock" (or "aero snap" like it is sometimes called), the glass areas are all black. Using the Maximize button or a double click into the "DwmdefWindowProc-handled" title bar, the glass shows up correctly.
I tried to call DwmExtendFrameIntoClientArea again on WM_WINDOWPOSCHANGING (if Flags contains flag SWP_STATECHANGED), but this doesn't help.
Can someone please help me out here? What goes on behind the scenes and what event should be handled in what manner to solve this?
Thank you in advance!
- Edited by Blindspot Monday, September 24, 2012 9:13 AM
Wednesday, September 26, 2012 6:08 AMModerator
I'm doing research on this issue and I will let you know if I get anything.
Bob Wu [MSFT]
MSDN Community Support | Feedback to us
Friday, September 28, 2012 5:36 AMModerator
All seems to be good, but when maximizing the window using "aero dock" (or "aero snap" like it is sometimes called), the glass areas are all black.
I'm not sure why your application doesn't work with aero-snap.
However, Microsoft All-In-One Code Framework provide sample demonstrates how to create a windows Form with Aero glass style. When you dragging the form to the edges of your screen, the aero glass style still works after sizing.
You should download and check the demo.
Bob Wu [MSFT]
MSDN Community Support | Feedback to us
Friday, September 28, 2012 7:17 AM
Thank you Bob for your effort helping me!
I tried this already and also used the Windows API Code Pack and the sample code there.
Extending the glass alone is not the problem, but extending the client area too (by implementing WM_NCCALCSIZE and _NCHITTEST ...) and keep the glass look is.
When extending the client area that way, one must fill the glass regions with a black brush. But it seems that this fill has to be the first thing to be done in a series of drawing operations, because if you draw a text with the same black brush directly after filling the background, you get a black text over glass. Also, if you not set Form's TransparencyKey (!important anyway), you can draw images with an aplha channel, that are perfectly blended over the glass when the area was filled black before. (Please correct me, if my conclusions are wrong.)
So, the problem now is:
a) if the window is maximized using the window button or a double click at the caption bar, OnPaint is called and makes its black brush fill wich results in a fine glass look in the black-filled areas.
b) if the same is done using aero snap, OnPaint is called too like in a) but the black filled areas appear black.
So, what's going on here? It seems, that in b) I'm too late filling the background black... (?)
- Edited by Blindspot Friday, September 28, 2012 7:19 AM misspellings
Tuesday, October 09, 2012 7:45 PMModerator
From a support perspective this is really beyond what we can do here in the forums. If you cannot determine your answer here or on your own, consider opening a support case with us. Visit this link to see the various support options that are available to better meet your needs: http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone.
Dave Anderson - Microsoft
Please remember to "Mark As Answer" the replies that help.
Thursday, October 11, 2012 6:06 PM
I played around with Glass a couple of years ago and I found that filling with an empty brush rather than a black brush gave the desired results.
You may find it useful to take a look at my implementation in the GlassUI library that I started. Just follow the link in my signature.
There are problems with Glass so far as ToolStripContainers are concerned, but I don't recall having many issues elsewhere.
Tuesday, October 23, 2012 5:34 PM
Did you ever sort this out? I'm running into the same exact scenario as you and haven't found an answer thus far. When extending glass into a window and handling WM_NCCALCSIZE, everything works fine if clicking the maximize button or double-clicking the titlebar. But Aero docking to the desktop top to maximize the window will cause glass to be rendered black.
actiprosoftware.com - Professional WPF, WinRT, Silverlight, and WinForms UI controls and components
Tuesday, October 30, 2012 3:14 PM
that's exact my problem. B.tw. it seems even Firefox has the problem (after hibernating the system a few times).
I don't have a solution yet, but I will post it here, when I have one.
Tuesday, October 30, 2012 3:15 PM
thank you for your reply! I will check this out.
Tuesday, October 30, 2012 5:46 PM
My example doesn't use WM_NCCALCSIZE, which is needed if you wish the top of your ClientArea to look like it has a Non-ClientArea (i.e. put controls in the titlebar), but i did once look into this for another user who wanted to use a ribbon control. I'm pretty sure that this had similar issues when using a black brush, but worked OK with an Empty brush. I don't have that sample to hand anymore but if you don't get any success I'm happy to look into it for you if you can provide a basic example of the code to save me time reproducing it.