

After all, this is the subsystem responsible for providing the look and feel for controls. On a hunch, I started my search in the Themes and Visual Styles section of the SDK.

By the way, if you do not regularly read the Windows SDK I highly encourage that you do so. Having received yet another email yesterday asking about edit controls on glass I decided to poke around the Windows SDK to see if it has anything new to offer. It is at times like these that I wonder why I don’t work for Microsoft and am not compensated for the articles I post on my blog… :) I repeat: How can I display an edit control on glass?!

Unfortunately, it does not play nicely with glass since the technique involves GDI primitives that do not support alpha blending. Notably it does not work with edit controls.Īn even simpler approach is custom draw but this works with an even smaller set of controls.įinally, for a small number of controls you can handle WM_CTLCOLORxxx to set the text and background color of the control.Ĭonsidering the options listed thus far, only the last one actually supports edit controls and does not involve a gargantuan amount of work. Owner draw is nice and works for most but not all controls. This is a lot of work but a lot less than the WM_PAINT approach as the system does a lot of the work for you. My DWM sample demonstrates this technique, albeit not with a control.Īnother solution is to owner draw controls.

This tends to be more work than it’s worth so most developers avoid it, however it does allow you all the freedom necessary to paint with the necessary alpha channel information to render correctly on glass. You can handle WM_PAINT and draw it yourself. Specifically, there are a number of ways to override the default drawing behavior of the standard and common controls. There are a number of ways of solving this sort of problem. How can I display an edit control on glass?! For the sake of my email inbox, I am going to present a simple solution to address the most common request: Having said my piece about DWM and what with being extremely busy with my day job and various other commitments I never quite found the time to present alternative solutions. Unfortunately, when Microsoft finally released Windows Vista this “hack” no longer worked leaving developers to wonder how it could be done. I demonstrated this technique in the article. Those early builds included a hack that allowed you to easily draw controls on glass by tweaking the transparency key. If you recall, I wrote the DWM article before the release of Windows Vista to manufacturing. Of all the Windows Vista for Developers series articles that I have written, the one about the Desktop Window Manager (DWM) is by far the most popular considering the blog traffic statistics and the amount of email I receive with questions about glass.īy far the most common question I hear is about how to get controls to render correctly on glass.
