Click here to Skip to main content
6,291,722 members and growing! (13,866 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, Win Mobile, Mobile, Win2K, WinXP, Win2003, Visual Studio, MFC, Dev
Posted:15 Aug 2003
Views:80,611
Bookmarked:45 times
Announcements
Loading...
 
Search    
Advanced Search
printPrint   Broken Article?Report       add Share
  Discuss Discuss   Recommend Article Email
13 votes for this article.
Popularity: 3.65 Rating: 3.28 out of 5

1
2 votes, 15.4%
2
2 votes, 15.4%
3
6 votes, 46.2%
4
3 votes, 23.1%
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


Member

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

Other popular Mobile Development articles:

  • Writing Your Own GPS Applications: Part 2
    In part two of the series, the author of "GPS.NET" teaches developers how to write GPS applications suitable for the real world by mastering GPS precision concepts. Source code includes a working NMEA interpreter and sample high-precision application in C# and VB.NET.
  • Writing Your Own GPS Applications: Part I
    What is it that GPS applications need to be good enough to use for in-car navigation? Also, how does the process of interpreting GPS data actually work? In this three-part series, I will cover both topics and give you the skills you need to write a commercial-grade GPS application.
  • Learn How to Find GPS Location on Any SmartPhone, and Then Make it Relevant
    A step by step tutorial for getting GPS from any SmartPhone, even without GPS built in, and then making location useful.
  • Pocket 1945 - A C# .NET CF Shooter
    An article on Pocket PC game development
  • iPhone UI in Windows Mobile
    It's an interface that works with transparency effects. As a sample I used an interface just like the iPhone one. In this tutorial I am explaining how simple is working with transparency on Windows Mobile.
Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 10 of 10 (Total in Forum: 10) (Refresh)FirstPrevNext
GeneralMy vote of 2 Pinmemberdadahacker19:15 19 Jun '09  
GeneralException when there are many, many objects Pinmemberacp9235:17 29 Mar '06  
GeneralWhat if you have a dynamic bitmap background ? Pinmemberghostve4:29 28 Dec '04  
GeneralRe: What if you have a dynamic bitmap background ? PinsussAnonymous4:59 28 Dec '04  
GeneralThe WM_CTLCOLORSTATIC message handler and comboboxes. PinmemberDe Nys, FX11:47 11 Apr '04  
GeneralApply this sample only on the second DlgBox PinmemberGuilhemMtp6:25 31 Mar '04  
GeneralRe: Apply this sample only on the second DlgBox PinsussAnonymous3:33 14 Apr '04  
GeneralRe: Apply this sample only on the second DlgBox Pinmemberwqter1:12 25 Jun '04  
GeneralYou can have only one brush... PinmemberDic4:47 27 Oct '03  
GeneralRe: You can have only one brush... PinmemberJohann 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-2009
Web15 | Advertise on the Code Project