5,276,156 members and growing! (18,713 online)
Email Password   helpLost your password?
Platforms, Frameworks & Libraries » Mobile Development » Dialogs and Windows     Intermediate

Transparent Controls with custom image backgrounds on PocketPC

By Hyungchul Shin

Transparent Controls with custom image backgrounds on PocketPC
VC6, VC7, VC7.1, C++, WinCE, Windows, Win2K, WinXP, Win2003, Visual Studio, Mobile, MFC, Dev

Posted: 15 Aug 2003
Updated: 15 Aug 2003
Views: 65,816
Announcements
Want a new Job?



Search    
Advanced Search
Sitemap
12 votes for this Article.
Popularity: 3.66 Rating: 3.39 out of 5
0 votes, 0.0%
1
1 vote, 8.3%
2
2 votes, 16.7%
3
6 votes, 50.0%
4
3 votes, 25.0%
5

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Hyungchul Shin



Occupation: Web Developer
Location: Korea, Republic Of Korea, Republic Of

Other popular Mobile Development articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 9 of 9 (Total in Forum: 9) (Refresh)FirstPrevNext
Subject  Author Date 
GeneralException when there are many, many objectsmemberacp9235:17 29 Mar '06  
GeneralWhat if you have a dynamic bitmap background ?memberghostve4:29 28 Dec '04  
GeneralRe: What if you have a dynamic bitmap background ?sussAnonymous4:59 28 Dec '04  
GeneralThe WM_CTLCOLORSTATIC message handler and comboboxes.memberDe Nys, FX11:47 11 Apr '04  
GeneralApply this sample only on the second DlgBoxmemberGuilhemMtp6:25 31 Mar '04  
GeneralRe: Apply this sample only on the second DlgBoxsussAnonymous3:33 14 Apr '04  
GeneralRe: Apply this sample only on the second DlgBoxmemberwqter1:12 25 Jun '04  
GeneralYou can have only one brush...memberDic4:47 27 Oct '03  
GeneralRe: You can have only one brush...memberJohann Gerell0:19 31 Oct '03  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 15 Aug 2003
Editor: Nick Parker
Copyright 2003 by Hyungchul Shin
Everything else Copyright © CodeProject, 1999-2008
Web20 | Advertise on the Code Project