Click here to Skip to main content
11,716,938 members (86,509 online)
Click here to Skip to main content

Scratchpad/Signature Capture as BMP on Pocket PC

, 6 Sep 2006 CPOL 138.7K 2K 56
Rate this:
Please Sign up or sign in to vote.
A way to capture signature or scribble on the Pocket PC.

Sample Image - SignaturePPC02.gif Sample Image - SignaturePPC02.gif

Sample Image - SignaturePPC02.gif

Introduction

This control class allows a user to take a colored jot down note or signature, and save it as BMP file in the Pocket PC. This easy to use code can be plugged into any .NET application to take scribbles.

Background

Quite for a long time, I was looking for a free Signature control or some thing like that, that I could use in my own application without overloading it with bulkier codes. I was looking for some thing where I could change the pen color, width, and so on. In the internet knowledge bases, there was very few information on this, and most did not suit my needs. Later, I thought of assembling the available code and stripping down the un-needed portions, and fine-tuning the code to the level of my expectations.

Thought, may be a few people like me are still looking for this kind of a snippet and thought of sharing it. There are a few portions in this code that a programmer can even modify, like make the pen width changeable, save image as JPG or GIF etc.

Using the code

Copy the Signature.cs file to any of your Pocket PC 2003 projects. Add a Panel control to the visual form. Put this code as described and get the project rolling with signature capture capability.

Here, I have added a Panel:

private System.Windows.Forms.Panel pnlSignature;
private Signature cSignature;

Later in the constructor, or in the form Load event, you can add:

cSignature = new Signature();
cSignature.Location = pnlSignature.Location;
cSignature.Size = pnlSignature.Size;
this.pnlSignature.Visible = false;
this.Controls.Add(cSignature);

Under any Button's Click event, you can write this code to save the file under your desired location with a name:

cSignature.Save(Path.Combine(AppPath, "CapturedPicture.bmp"));

Similarly, you can change the pen color by calling:

cSignature.SetPenColor(Color.Blue);

or load a previously saved picture of the same size, using:

cSignature.LoadImage(Path.Combine(AppPath, 
        "PreviouslyCapturedPicture.bmp"));

Tips and Tricks:

  1. Do not forget to set the Visibility of the Panel to false, as we need to see the control, not the Panel. Here, the Panel is just a container.
  2. It is more important to set the size of the signature control to the size of the loaded picture and the Panel size, else it may not work.

Points of Interest

While working on this, I changed the pen width by changing the following lines of code. Obviously, there must be a better way to do this than what I did.

GraphicsHandle.DrawLine(SignaturePen, l.StartX+1, 
                      l.StartY, l.EndX+1,l.EndY);
GraphicsHandle.DrawLine(SignaturePen, l.StartX, 
                  l.StartY+1, l.EndX,l.EndY+1);
GraphicsHandle.DrawLine(SignaturePen, l.StartX+1, 
                  l.StartY+1, l.EndX+1,l.EndY+1);
GraphicsHandle.DrawLine(SignaturePen, l.StartX, 
                      l.StartY, l.EndX,l.EndY);

License

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

Share

About the Author

RajeshNayak
Web Developer
United States United States
Rajesh Nayak currently working with CSDC Systems Inc.'s (canada East Zone - R&D Branch) as Product Manager-Mobile Solutions.

You may also be interested in...

Comments and Discussions

 
GeneralWinforms User Signature Capture Control Pin
jay_dubal31-Mar-11 0:19
memberjay_dubal31-Mar-11 0:19 
GeneralSignature Capture in standalone(Windows Forms Application) Pin
radhikakiran1313-Jan-10 9:37
memberradhikakiran1313-Jan-10 9:37 
GeneralSaves a white background (no ink marks) Pin
Jacob Dixon16-Nov-09 10:46
memberJacob Dixon16-Nov-09 10:46 
Question2 color bitmap Pin
Natarajan R22-Jul-09 22:54
memberNatarajan R22-Jul-09 22:54 
Questionhow do I get this to work Pin
Lisa Mulcahy27-May-09 4:22
memberLisa Mulcahy27-May-09 4:22 
AnswerRe: how do I get this to work Pin
grandk28-Nov-09 8:44
membergrandk28-Nov-09 8:44 
NewsASP.NET Signature Capture Pin
jay_dubal26-Aug-08 0:33
memberjay_dubal26-Aug-08 0:33 
Generalgetting error during save the file Pin
souravmoy sau18-Jun-08 2:44
membersouravmoy sau18-Jun-08 2:44 
QuestionRunning with parameter (e.g. Filename) Pin
conny12319-Nov-07 5:06
memberconny12319-Nov-07 5:06 
QuestionHow can I give a BackgroundImage for the Control. Pin
ajsri7727-Sep-07 1:02
memberajsri7727-Sep-07 1:02 
GeneralWM 60 Pin
smidz15-Aug-07 4:14
membersmidz15-Aug-07 4:14 
GeneralConversion to JPG Pin
Sambora20-Jul-07 6:22
memberSambora20-Jul-07 6:22 
GeneralRe: Conversion to JPG Pin
RajeshNayak20-Jul-07 7:35
memberRajeshNayak20-Jul-07 7:35 
GeneralRe: Conversion to JPG Pin
Sambora20-Jul-07 7:41
memberSambora20-Jul-07 7:41 
Generaladd to word Pin
simon250213-Jul-07 0:37
membersimon250213-Jul-07 0:37 
GeneralRe: add to word Pin
RajeshNayak13-Jul-07 1:23
memberRajeshNayak13-Jul-07 1:23 
GeneralSignature Control on Windows Tab Pin
Haroon Khokhar24-Jun-07 20:35
memberHaroon Khokhar24-Jun-07 20:35 
GeneralRe: Signature Control on Windows Tab Pin
RajeshNayak13-Jul-07 1:09
memberRajeshNayak13-Jul-07 1:09 
QuestionJust black and white image Pin
Sergey Kamenev31-May-07 13:52
memberSergey Kamenev31-May-07 13:52 
AnswerRe: Just black and white image Pin
RajeshNayak13-Jul-07 1:11
memberRajeshNayak13-Jul-07 1:11 
QuestionRe: Just black and white image Pin
Natarajan R22-Jul-09 22:58
memberNatarajan R22-Jul-09 22:58 
QuestionSignature Capture in VB.NET Pin
Shashidhar19-Apr-07 18:28
memberShashidhar19-Apr-07 18:28 
AnswerRe: Signature Capture in VB.NET Pin
RajeshNayak13-Jul-07 1:13
memberRajeshNayak13-Jul-07 1:13 
Generalcannot capture mouse event on tabpage Pin
Amit Singh4-Feb-07 0:34
memberAmit Singh4-Feb-07 0:34 
GeneralRe: cannot capture mouse event on tabpage Pin
Francisco Perez Menacho30-Mar-07 10:22
memberFrancisco Perez Menacho30-Mar-07 10:22 
GeneralRe: cannot capture mouse event on tabpage Pin
RajeshNayak13-Jul-07 1:16
memberRajeshNayak13-Jul-07 1:16 
GeneralRe: cannot capture mouse event on tabpage Pin
Member 452109029-Jun-09 2:42
memberMember 452109029-Jun-09 2:42 
Generalnot working Pin
Maha Ibrahim2-Dec-06 21:51
memberMaha Ibrahim2-Dec-06 21:51 
GeneralRe: not working Pin
RajeshNayak3-Dec-06 5:16
memberRajeshNayak3-Dec-06 5:16 
GeneralRe: not working Pin
Maha Ibrahim3-Dec-06 20:54
memberMaha Ibrahim3-Dec-06 20:54 
GeneralRe: not working Pin
RajeshNayak13-Jul-07 1:17
memberRajeshNayak13-Jul-07 1:17 
GeneralRe: not working Pin
dravisha21-Aug-07 5:44
memberdravisha21-Aug-07 5:44 
GeneralPicture Box Image Pin
ribeirovski21-Nov-06 6:20
memberribeirovski21-Nov-06 6:20 
GeneralRe: Picture Box Image Pin
RajeshNayak3-Dec-06 5:20
memberRajeshNayak3-Dec-06 5:20 
QuestionPossible for VB.NET? Pin
kokgin2-Nov-06 18:42
memberkokgin2-Nov-06 18:42 
AnswerRe: Possible for VB.NET? Pin
Piasecznik15-Nov-06 23:00
memberPiasecznik15-Nov-06 23:00 
GeneralRe: Possible for VB.NET? Pin
james19772-Dec-06 13:35
memberjames19772-Dec-06 13:35 
QuestionHow about ASP.NET? Pin
snowdog85025-Oct-06 9:26
membersnowdog85025-Oct-06 9:26 
AnswerRe: How about ASP.NET? Pin
RajeshNayak25-Oct-06 9:39
memberRajeshNayak25-Oct-06 9:39 
GeneralRe: How about ASP.NET? Pin
snowdog85025-Oct-06 16:52
membersnowdog85025-Oct-06 16:52 
QuestionVB.Net version and CE5 anyone? Pin
visionid14-Oct-06 0:57
membervisionid14-Oct-06 0:57 
AnswerRe: VB.Net version and CE5 anyone? Pin
RajeshNayak25-Oct-06 9:36
memberRajeshNayak25-Oct-06 9:36 
QuestionLOOK BITMAP IMAGE TO THE CRYSTAL REPORT .NET Pin
ANDREASANTINI25-Sep-06 23:15
memberANDREASANTINI25-Sep-06 23:15 
AnswerRe: LOOK BITMAP IMAGE TO THE CRYSTAL REPORT .NET Pin
RajeshNayak25-Oct-06 9:34
memberRajeshNayak25-Oct-06 9:34 
QuestionLicense Pin
athmok@yahoo.co.uk18-Sep-06 1:11
memberathmok@yahoo.co.uk18-Sep-06 1:11 
AnswerRe: License Pin
RajeshNayak18-Sep-06 2:07
memberRajeshNayak18-Sep-06 2:07 
GeneralRe: License Pin
Athmok21-Sep-06 3:10
memberAthmok21-Sep-06 3:10 
Questionit is not working in VS.net 2005 Pin
Tamiil4-Jul-06 2:17
memberTamiil4-Jul-06 2:17 
AnswerRe: it is not working in VS.net 2005 Pin
Rothariger4-Sep-06 8:26
memberRothariger4-Sep-06 8:26 
GeneralRe: it is not working in VS.net 2005 Pin
RajeshNayak6-Sep-06 10:14
memberRajeshNayak6-Sep-06 10:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150901.1 | Last Updated 6 Sep 2006
Article Copyright 2006 by RajeshNayak
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid