Skip to main content

Past Blast

Featured Products

Windows Mobile Developer Controls
Windows Mobile Developer Controls
Stay in touch using the DEVBUSS RSS feeds.
 

News

Windows Mobile Developer Controls
Sapphire Soltuions

Signature capture with eVB

Written by Simon Rackstraw  [author's bio]  [read 58519 times]
Edited by Derek

Download the code

Page 1  Page 2 

In the example eVB project you will see that the MouseDown event has been modified to store the Y coordinate + 128, this sets the MSB of the Y byte signifying the start of a new line. Coordinates stored in the MouseMove event do not set the MSB, and are therefore interpreted as being line ends.

After capturing the coordinates into an array using this method, we are ready to store the results. Personally I like to see my data, so in the example project I've encoded the data into a text string that can easily be stored in a database record or even written out as XML. The string is simply the coordinates pairs stored in 8-bit hexadecimal format, no delimiting is necessary as each pair will always consist of 4 characters.

E.g. "XXYYxxyyxxyyxxyyXXYYxxyyxxyy" (Capitals denote MSB set in Y)

Example Projects

The example Pocket PC eVB project included with this article is a simple demonstration form that you can sign. The encoded results are then displayed as text as well as being written to the file "\my documents\signature.txt". One notable feature of the demo is the "Sign Here" watermark effect in the signature box, since we aren't storing the actual graphics you could use any image you like!

To demonstrate how simple decoding is, also included with this article is a desktop PC Visual Basic project that will load the signature file, decode it, and display the results.

Final analysis

In case you're not quite convinced, take a look at the following example and scale the savings made over the number of signatures you expect to capture during a working session.

Raw image 19,200 bytes
GIF image 1,400 bytes
Text Vector 508 bytes
Raw Vector 254 bytes

I’m sure most people would be quite happy with the loss of compression due to storing the vector in text format, simply because it is so much easier to handle. Best of all though, it’s all been possible without adding any extra controls!

Previous Page