As is known, the first noticeable thing when moving from Windows XP to Windows Vista or Windows 7 is the enhanced graphical user interface, and if your hardware is good enough to support the Windows Aero Theme, you'll get great looks for the window title bars (see the figure below):
But if this theme is not enabled due to lack of good enough hardware, or is manually disabled by the user, the window titles will appear like this:
And here, we are going to get some control of this feature (the Glass Effect of the window titles and frames).
Window Desktop Manager
In the old days of Windows XP and earlier, each window was responsible to draw directly to the screen or the primary display device, but starting from Windows Vista, this is no longer happening, and a new feature has been introduced. This feature, called the Window Desktop Manager, is a service responsible for Desktop Composition that changes the way applications display pixels on the screen, so all the drawing of the individual windows will be redirected into an off-screen surface in the video memory, then this surface rendered into a desktop image and displayed on the screen.
This feature of desktop compositing enables the developers of the Operating System to add many different visual effects to the desktop windows such as:
- 3D animations.
- 3D flip of Desktop windows.
- Glass Effect of window title bars and frames (the scope of this article).
- Interactive thumbnails on the Task Bar.
This new feature comes with a rich set of APIs that can be called to manage, control, and make use of the new possible visual effects available in these Operating Systems, and here we are going to use some of them (actually just two of the WDM API functions):
Note: You can find the Windows Desktop Manager as a service (or process) called wdm.exe in the [Processes Tab] of the Windows Task Manager.
Windows Glass (Blur) Effect
The Glass or Blur Effect is an effect of the title bars and frame borders of the windows that display the items behind these title bars and frame borders in a semi-transparent way (see the Recycle Bin icon indicated by the arrow):
Actually, it is not just a transparency, but it displays the objects behind as blurry and just like what a glass does (and that is why it is known as the Glass Effect). This feature is cool and gives our windows a great look (I still remember the question of some friend when he saw a snapshot of a small program that I made previously "How did you do this effect of the title bar?" he said. And my answer was: "I did nothing! This is done by the Operating System itself and this is how the window titles look like on Windows Vista!") .... He was shocked just because he had not seen Windows Vista before. Anyhow, we are going here to add some control to this Glass Effect of the windows and make it look better and as we need.
Our Glass Effect Extender Library
What I'm going to introduce here is to add some flexibility to the Glass Effect and make it possible to:
- Extend the area of the glass effect to any side of the form (make it not just limited by the title bar and frames).
- Make it possible to show an image between the glass effect area and the other client area.
- Draw texts on the glass with a glow around, just like the OS does on the title bars.
These three features are shown in the figure below:
Now, to use this library in your application, just add a reference to the library file rtaGlassEffectsLib.dll which can be found in the attachments of this article.
And then, simply declare a variable of type
rtaGlassEffect as follows: