Click here to Skip to main content
12,820,283 members (27,578 online)
Click here to Skip to main content
Add your own
alternative version


13 bookmarked
Posted 18 Apr 2004

Need a flashlight for your PocketPC?

, 18 Apr 2004 CPOL
Rate this:
Please Sign up or sign in to vote.
This is an article on how to make a flashlight out of your PocketPC


This is one of the simplest applications ever created. It just sets the entire screen to white and you can use it as a flashlight. This application was inspired by my brother's boss. His boss had at one time had a program that turned the screen completely white so that it could be used as a flashlight. I decided that this would be a good starting point for some PocketPC apps.


This implementation was surprisingly tricky. Since the .NET Compact Framework does not have all of the functionality of the full .NET Framework, I had to work around a few things. First, I had planned to draw the images using pictureBox1.CreateGraphics(), but that gave a "not supported" error. So, I just cheated and made a regular windows application and just saved the image to file. Now the application just loads a picture instead of drawing it. Next, I had to figure out how to adjust the backlight. I still have not figured out how to do that. So, once again, I cheated and just set the back color to a grey scale based on where you pressed on the scale. Last, I found that picture boxes had no click event. This is the only one where I didn't cheat. I loaded the images into the picture boxes, but then on the form's graphics control I did (form graphics).DrawImage(pictureBox1.Image, 0, 0). Past that, it was pretty easy to make. I purposely put the close button on the opposite side so that you did not close it on accident. You'll also notice that I have a timer that just runs once. I found that this is the best way that I came up with to configure the controls once the form is viewable.

Using the code

Really, there should be no reason that this code would need to be altered in any way. That doesn't mean that you shouldn't. This has only one class and it was created by Visual Studio. Really, there isn't anything special about it. This does have one special function to truncate the decimal.

private int Trunc(double d) 
 // used to take the int value without the decimal place
  string i = d.ToString().Split(((string)(".")).ToCharArray())[0]; 
   // splits the double vaule at the decimal and only takes the first part
  return int.Parse(i); // converts the string to and int

To use this you just call it by saying Trunc(3.14159). This function would return 3.

Points of Interest

The main thing I learned from this application is that it is not as easy as you think to capture click events from a picture box. Otherwise, this is just a warm-up application.


There is no history for this app. It has one version. The end.


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


About the Author

United States United States
No Biography provided

You may also be interested in...


Comments and Discussions

Generalbacklight Pin
Embex21-Nov-07 7:03
memberEmbex21-Nov-07 7:03 
Questionso there is no way to draw image on picturebox? Pin
raybristol14-Aug-05 7:54
memberraybristol14-Aug-05 7:54 
AnswerRe: so there is no way to draw image on picturebox? Pin
Simon McKenzie5-Mar-08 13:48
memberSimon McKenzie5-Mar-08 13:48 
GeneralRe: trunc function ?? Pin
Erik_Egsgard22-Jun-04 5:09
memberErik_Egsgard22-Jun-04 5:09 
GeneralAhh at last - a use for the Pocket PC ! Pin
Bob100020-Apr-04 13:57
sussBob100020-Apr-04 13:57 
QuestionIs it serious ? Pin
BenoitM19-Apr-04 23:29
memberBenoitM19-Apr-04 23:29 
AnswerRe: Is it serious ? Pin
MichaelCoder20-Apr-04 10:58
memberMichaelCoder20-Apr-04 10:58 
Questiontrunc function ?? Pin
sriramsinga19-Apr-04 10:01
membersriramsinga19-Apr-04 10:01 
AnswerRe: trunc function ?? Pin
MichaelCoder20-Apr-04 11:01
memberMichaelCoder20-Apr-04 11:01 
Generalipaq sdk Pin
sriramsinga19-Apr-04 9:57
membersriramsinga19-Apr-04 9:57 
GeneralRe: ipaq sdk Pin
MichaelCoder20-Apr-04 11:02
memberMichaelCoder20-Apr-04 11:02 
GeneralRe: ipaq sdk Pin
jkutsor21-Apr-04 2:41
memberjkutsor21-Apr-04 2:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    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 | Terms of Use | Mobile
Web02 | 2.8.170308.1 | Last Updated 19 Apr 2004
Article Copyright 2004 by MichaelCoder
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid