Pocket PC 2003 : Saving the signature as a bitmap

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.

Code :

_signature = new SignatureControl();

            _signature.Location = areaSignature.Location;

      _signature.Size = areaSignature.Size;

 

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

Code :

            this.pnlCaptureSign.Controls.Add(_signature);

 

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

Code :

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.

 

For any queries related to this please mail to [email protected]

 

My Details

Name: Pinto Philip (MCSD.NET)

Senior Software Engineer

HP India

Mail: [email protected]

 

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/Code/2005/Feb/RotateText_WinCE.asp

  2. Simplifying Remoting in .Net
    URL : http://msd2d.com/Content/Tip_viewitem.aspx?section=dotNet&id=0acc3ac3-927f-421c-84a0-b8827b11ce65

  3. Working with Check boxes in Data Grid
    URL:http://www.msd2d.com/Content/Tip_viewitem_03.aspx?section=dotNet&category=Application%20Development&id=02f52884-64b5-488e-b0bc-0e2ace59bebd

 

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish