Click here to Skip to main content
6,822,613 members and growing! (19,914 online)
Email Password   helpLost your password?
Platforms, Frameworks & Libraries » Mobile Development » GDI+     Intermediate

Scratchpad/Signature Capture as BMP on Pocket PC

By RajeshNayak

A way to capture signature or scribble on the Pocket PC.
C#, Windows, .NETCF, .NET1.1, .NET2.0, WinMobile2003VS.NET2003, VS2005, Dev
Posted:27 Jan 2006
Updated:6 Sep 2006
Views:84,623
Bookmarked:49 times
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
16 votes for this article.
Popularity: 5.61 Rating: 4.66 out of 5

1

2

3
2 votes, 12.5%
4
14 votes, 87.5%
5

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

RajeshNayak


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

Occupation: Web Developer
Location: United States United States

Other popular Mobile Development articles:

  • Writing Your Own GPS Applications: Part 2
    In part two of the series, the author of "GPS.NET" teaches developers how to write GPS applications suitable for the real world by mastering GPS precision concepts. Source code includes a working NMEA interpreter and sample high-precision application in C# and VB.NET.
  • Writing Your Own GPS Applications: Part I
    What is it that GPS applications need to be good enough to use for in-car navigation? Also, how does the process of interpreting GPS data actually work? In this three-part series, I will cover both topics and give you the skills you need to write a commercial-grade GPS application.
  • Learn How to Find GPS Location on Any SmartPhone, and Then Make it Relevant
    A step by step tutorial for getting GPS from any SmartPhone, even without GPS built in, and then making location useful.
  • Windows Mobile, iPhone, Android - Marketplace Comparison
    Detailed comparison between Windows Mobile Marketplace, Apple's iPhone AppStore and Android Market from developer point of view.
  • iPhone UI in Windows Mobile
    It's an interface that works with transparency effects. As a sample I used an interface just like the iPhone one. In this tutorial I am explaining how simple is working with transparency on Windows Mobile.
Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 25 of 63 (Total in Forum: 63) (Refresh)FirstPrevNext
GeneralSignature Capture in standalone(Windows Forms Application) Pinmemberradhikakiran1310:37 13 Jan '10  
GeneralSaves a white background (no ink marks) PinmemberJacob Dixon11:46 16 Nov '09  
Question2 color bitmap PinmemberNatarajan R23:54 22 Jul '09  
Questionhow do I get this to work PinmemberLisa Mulcahy5:22 27 May '09  
AnswerRe: how do I get this to work Pinmembergrandk9:44 28 Nov '09  
NewsASP.NET Signature Capture Pinmemberjay_dubal1:33 26 Aug '08  
Generalgetting error during save the file Pinmembersouravmoy sau3:44 18 Jun '08  
QuestionRunning with parameter (e.g. Filename) Pinmemberconny1236:06 19 Nov '07  
GeneralHow can I give a BackgroundImage for the Control. Pinmemberajsri772:02 27 Sep '07  
GeneralWM 60 Pinmembersmidz5:14 15 Aug '07  
GeneralConversion to JPG PinmemberSambora7:22 20 Jul '07  
GeneralRe: Conversion to JPG PinmemberRajeshNayak8:35 20 Jul '07  
GeneralRe: Conversion to JPG PinmemberSambora8:41 20 Jul '07  
Generaladd to word Pinmembersimon25021:37 13 Jul '07  
GeneralRe: add to word PinmemberRajeshNayak2:23 13 Jul '07  
GeneralSignature Control on Windows Tab PinmemberHaroon Khokhar21:35 24 Jun '07  
GeneralRe: Signature Control on Windows Tab PinmemberRajeshNayak2:09 13 Jul '07  
QuestionJust black and white image PinmemberSergey Kamenev14:52 31 May '07  
AnswerRe: Just black and white image PinmemberRajeshNayak2:11 13 Jul '07  
QuestionRe: Just black and white image PinmemberNatarajan R23:58 22 Jul '09  
QuestionSignature Capture in VB.NET PinmemberShashidhar19:28 19 Apr '07  
AnswerRe: Signature Capture in VB.NET PinmemberRajeshNayak2:13 13 Jul '07  
Generalcannot capture mouse event on tabpage PinmemberAmit Singh1:34 4 Feb '07  
GeneralRe: cannot capture mouse event on tabpage PinmemberFrancisco Perez Menacho11:22 30 Mar '07  
GeneralRe: cannot capture mouse event on tabpage PinmemberRajeshNayak2:16 13 Jul '07  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

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

PermaLink | Privacy | Terms of Use
Last Updated: 6 Sep 2006
Editor: Smitha Vijayan
Copyright 2006 by RajeshNayak
Everything else Copyright © CodeProject, 1999-2010
Web21 | Advertise on the Code Project