|
-
April 28th, 2011, 03:18 PM
#7
Re: How exactly do you create such "transparent" controls?
This could be easily done even without using WPF 
Just extend the non-client area into the client area (using DwmExtendFrameIntoClientArea) and drop a few owner-drawn or custom controls in the new 'frame' area. To draw the controls you'll need GDI+ because you can use semitransparent colors (ARGB) and alpha-blended images (PNG or 32-bit BMP).
GDI+ is a must because everything that is drawn black (0x000000) with plain old GDI (DrawText, FillRect, Ellipse, etc.) becomes transparent on the Aero Glass sheet. To draw text for example, you must use Color::Black from GDI+ because it has an extra alpha byte (0xFF000000 or so, i don't remember if it's 0xAARRGGBB or 0xBBGGRRAA).
The desktop compositing engine does the rest, just fill the background of the control with a black brush (GDI) or Color::Transparent (GDI+) and draw whatever you want over it, it will have a translucent background and if you have glass blur enabled it will be blurry also.
Here's an example I've made with MFC a few weeks ago:

Notice how the cancel button doesn't look good because it uses old GDI, but the other control (actually an owner-drawn CButton) blends with the background with per-pixel translucency (thanks to GDI+).
"A program is never less than 90% complete, and never more than 95% complete."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|