Pocket PC 2003 : Saving the Signature as a Bitmap


The Compact Framework supports only a subset of the graphical output features of the Desktop Framework. You can do all of the more commonly required text drawing operations such as selecting different fonts by name, in different sizes and styles, and also control the color of drawn text.But this is a small price to pay for the small memory footprint occupied by the Compact Framework.

The System.Drawing.Graphics namespace is commonly used for almost any forms in the desktop framework, hence it has got lots of facilities to draw any kind of image on to the device context. However this namespace in the smaller version of the framework or the compact framework as it is commonly called is having only a very few classes/functionalities.

However there are means to overcome these short comings by making use of the win32 functions readily available/provided to the compact world.

Problem at hand: A Route sales Representative of Company A carries out a order/ sales for one of his prominent client (say for Wal-Mart) and after delivering the goods to his client he comes with his Pocket PC to take a signature from him for the delivery made .We will now try to save the signature captured as a bitmap for later reference and for validation.



Diagram 1: Signature Capture

Let us see how we can capture and save this signature captured as a bitmap.

Steps to be followed:

1. Create a smart device application.

2. Add labels and the panel where the signature is to be done.

3. Add a Panel (areaSignature) which will specify the location and size of the signature control.

_signature = new SignatureControl();
_signature.Location = areaSignature.Location;
_signature.Size = areaSignature.Size;

4. Add this signature Control to the main Panel of the form.

this.pnlCaptureSign.Controls.Add(_signature);

5. On clicking Save this signature image needs to be stored as a bitmap for future reference or for verification.

GenBitmap.Snapshot(pnlCaptureSign, @"\Program Files\GenSignature\GenSign" +BmpCnt+".bmp");

GenBitmap is the class which implements the user defined method Snapshot. This method basically stores the info from the control into the bitmap header structures and finally transfers the data bits into a file with the extension as .bmp.

We have to basically make use of the win32 functions from coredll for implementing this feature in Compact framework.

Attached is also the code with the implementation of the method Snapshot which gives you the solution to the problem.

Other white papers written by the author:

1. Rotating the text display on a Pocket PC/Win CE device
URL : http://www.c-sharpcorner.com/UploadFile/pinto4378/RotateText_WinCE12022005005036AM/RotateText_WinCE.aspx

Up Next
    Ebook Download
    View all
    Learn
    View all