Creating bmp file from VB.NET

A

Andy Baker

I have a utility that captures a signature on a handheld device and stores
it as as string containing a series of points. I want to recreate this
signature as a bmp file using VB.NET code. To do this, I have created a
bitmap object using the following code
Dim bmpSignature as Bitmap
bmpSignature = New BitMap(240, 80)
and I then use the graphics object to replot the points on the new bitmap,
and save it using
bmpSignature.Save("C:\Signature.bmp")
If I look at the saved file in XP by right clicking and selecting Preview, I
can see the signature so the data looks OK. My problem is reading the file
in another application (specifically Crystal Reports XI, but Paint and Paint
Shop Pro cannot read it either) - I just see a black box of the right size.
After looking on the net, I have come to the (possibly incorrect) conclusion
that something is wrong in the header of the file that is causing these
programs not to be able to read it. I have a VB6 utility to read the header
of a bmp file, the file that my VB app has saved doesn't appear to contain
sensible values in any of the fields. Does the Save method of the VB bitmap
object create a file with a header, and if not how can I create one and then
add my data to the end of it? Most sample code that I have seen of this type
is in C++, and I am not much of a C++ programmer, so any help on how to do
this in VB.NET would be appreciated. Thanks in advance.
 
B

Bruce W. Darby

Andy,

Crystal Reports has a nasty habit of requiring a particular bit depth in the
..bmp's it can display. You MUST save the .bmp as a 24-bit .bmp for Crystal
Reports to display it properly.
 
A

Andy Baker

Hi Bruce

Thanks for that. I have solved it by creating an empty 24-bit ,bmp in Paint
Shop Pro, and writing my signature onto that. Crystal Reports now reads it
OK.
 
B

Bruce W. Darby

You're most welcome, Andy :)

Andy Baker said:
Hi Bruce

Thanks for that. I have solved it by creating an empty 24-bit ,bmp in
Paint Shop Pro, and writing my signature onto that. Crystal Reports now
reads it OK.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top