Click here to Skip to main content
Licence CPOL
First Posted 15 Aug 2003
Views 97,957
Downloads 762
Bookmarked 58 times

Transparent controls with custom image backgrounds on PocketPC

By | 15 Aug 2003 | Article
Transparent Controls with custom image backgrounds on PocketPC

Sample Image - transparent_controls.jpg

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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Hyungchul Shin

Web Developer

Korea (Republic Of) Korea (Republic Of)

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 2 Pinmemberdadahacker18:15 19 Jun '09  
GeneralException when there are many, many objects Pinmemberacp9234:17 29 Mar '06  
QuestionWhat if you have a dynamic bitmap background ? Pinmemberghostve3:29 28 Dec '04  
AnswerRe: What if you have a dynamic bitmap background ? PinsussAnonymous3:59 28 Dec '04  
GeneralThe WM_CTLCOLORSTATIC message handler and comboboxes. PinmemberDe Nys, FX10:47 11 Apr '04  
GeneralApply this sample only on the second DlgBox PinmemberGuilhemMtp5:25 31 Mar '04  
GeneralRe: Apply this sample only on the second DlgBox PinsussAnonymous2:33 14 Apr '04  
GeneralRe: Apply this sample only on the second DlgBox Pinmemberwqter0:12 25 Jun '04  
GeneralYou can have only one brush... PinmemberDic3:47 27 Oct '03  
GeneralRe: You can have only one brush... PinmemberJohann Gerell23:19 30 Oct '03  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120528.1 | Last Updated 16 Aug 2003
Article Copyright 2003 by Hyungchul Shin
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid