Introduction
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.
Background
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)
{
string i = d.ToString().Split(((string)(".")).ToCharArray())[0];
return int.Parse(i); }
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.
History
There is no history for this app. It has one version. The end.