Introduction
I was writing a program on PPC 2002 and the program UI required a dialog with a bitmap image background. As I was designing the dialog in the eVC++ 3.0 dialog template editor, I added controls like static texts, group boxes and etc. I checked the transparent option in the property of each of the controls that I have added to the dialog. But on PPC 2002 the transparent option does not work like it does on PC Platform OSes. On CE, transparent windows behave as if they have WS_CLIPCHILDREN
style set. You can see through the parent dialog window itself. Definately not the effect I was hoping for.
There is an article for making transparent static texts at http://www.pocketpcdn.com/ and http://www.pocketpcdn.com/articles/transparent_static.html. It basically draws all of the static text in the WM_PAINT
handler of the parent dialog procedure. But if you have other controls such as group boxes, you will have to draw the group boxes yourself.
To solve this problem, I used the WM_CTLCOLORSTATIC
message handler. I first created a pattern brush with the bitmap image to be used as the backround for the dialog window. And in the WM_CTLCOLORSTATIC
message handler in the dialog procedure, I returned the brush handle I created previously. The downside to this method is that you'll have to create separate brushes for each of the controls that are to be transparent which means more memory usage. But you get the desired effect.