Click here to Skip to main content
Licence CPOL
First Posted 30 Jan 2003
Views 83,822
Downloads 250
Bookmarked 33 times

Colour Picker Control for Windows CE

By Joao Paulo Figueira | 5 Feb 2003
An implementation of the Office 97 style Colour Picker control for Windows CE.

1

2
1 vote, 11.1%
3

4
8 votes, 88.9%
5
4.88/5 - 9 votes
μ 4.88, σa 1.17 [?]

Sample Image - CeColourPicker.jpg

Introduction

This is a port of Chris Maunder's Office 97 style Colour Picker control[^] to Windows CE (PocketPC 2002). The code was adapted using the preprocessor macro _WIN32_WCE to enable transparent compilation in both eVC++ 3.0 and VC++ 6.0.

Porting

Here are the main points of the port.

Compatibility between CE and Desktop versions has been maintained through the precompiler, using the _WIN32_WCE #define.

The CE version of the popup is statically allocated in CColourPicker because CE does not support the WM_NCDESTROY message, making it impossible to dynamically delete the popup. This required the addition of a number of property set methods.

The popup is dismissed when the user clicks the button a second time, assuming a selection ended with cancel behavior.

The custom text button is not used to show up the CColorDialog. This class is not supported in MFC for the PocketPC 2002 SDK. One can still use the built in ChooseColor API, but the results are not very nice (see comment in the source code). The text changed to "Cancel".

WM_MOUSEMOVE is not used to make the color selection. CE has no mouse support and it would not be intuitive for a user to drag the pen just to start selecting the color. It has been replaced by WM_LBUTTONDOWN, and the handler code is the same.

This code has been tested in the PocketPC 2002 platform, compiles with no errors or warnings in Level 3 of eVC++ 3.0.

Revisions

  • 2003-02-06: Changed the OnKillFocus handler of CColourPopup in order to allow the popup to close when it loses focus.

License

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

About the Author

Joao Paulo Figueira

Software Developer
Primeworks
Portugal Portugal

Member
João is a Microsoft Device Application Development MVP and partner at Primeworks, a company that develops remote database access software for Windows Mobile.

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
Generalthe "X" button PinmemberparaGOD22:48 26 Dec '05  
GeneralRe: the "X" button PinmemberJoão Paulo Figueira0:39 27 Dec '05  
GeneralRe: the "X" button PinmemberparaGOD20:41 28 Dec '05  
GeneralRe: the "X" button PinmemberJoão Paulo Figueira0:08 29 Dec '05  
GeneralRe: the "X" button PinmemberparaGOD19:59 29 Dec '05  
QuestionCrashes under Windows Mobile 2003? Pinmembergniemcew15:51 25 Aug '04  
AnswerRe: Crashes under Windows Mobile 2003? PinmemberJoão Paulo Figueira23:17 25 Aug '04  
GeneralRe: Crashes under Windows Mobile 2003? Pinmembergniemcew6:25 26 Aug '04  
GeneralSource code for the example Pinmemberbiswa0:06 7 Mar '03  
GeneralRe: Source code for the example PinmemberJoão Paulo Figueira0:51 7 Mar '03  
GeneralRe: Source code for the example Pinmemberbiswa1:21 7 Mar '03  
GeneralRe: Source code for the example Pinmemberbm_masri17:55 17 Nov '03  
Hi Paulo,
 
Is it possible to add a demo program for this color picker. i'm still not sure how to add it to my dialog box. Sorry for troubling you.
 
Thanks
Confused | :confused:
 

 
Love for peace on earth
GeneralRe: Source code for the example PinmemberDaniel Jin5:06 24 Apr '05  
GeneralGreat job! PinmemberDaniel S.6:59 31 Jan '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.120210.1 | Last Updated 6 Feb 2003
Article Copyright 2003 by Joao Paulo Figueira
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid