yes. The Signature control in OpenNETCF exposes a method
(GetBytes() I think it is), but realize that when you use this, you
do not have a well-formed bitmap. In other words, if your goal
is to convert that signature into a byte[] and then ship that byte[]
back to a server (perhaps via SQL CE replication or via web
service call), when you go to reconstitute those bytes into a bitmap,
you will be missing the necessary header information to display the bytes
in a server-side WinForms Picurebox. So the trick is to do an intermediate
save as a file on device and then read that back in to a byte[]
and save the resulting byte[] to your database/send to the server.
This provides the missing header information you need.
Here's a sample:
// let's say this button is at the bottom of a SignatureForm
private void btnOK_Click(object sender, EventArgs e)
{
// pb is an OpenNetCF PictureBoxEx class
pb.SaveImage(@"\Program Files\appName\signature.bmp");
OwnerSignature = _convertBitmapToByteArray(@"\Program
Files\appName\signature.bmp");
File.Delete(@"\Program Files\appName\signature.bmp");
this.Close();
}
private byte[] _convertBitmapToByteArray(string filename)
{
MemoryStream ms = new MemoryStream();
Image img = new Bitmap(filename);
img.Save(ms, ImageFormat.Bmp);
return ms.ToArray();
}
--
Darren Shaffer
..NET Compact Framework MVP
Principal Architect
Connected Innovation
www.connectedinnovation.com