Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving a signature in PDA device

Status
Not open for further replies.

robert201

Programmer
Jul 18, 2007
80
TH
Hello,

VS 2005 CF 2.0

I have created a PDA device and will allow the user to write there signature.

However, I am having problems with the saving part.


I used the above as a example, and took out all the code I needed to draw the signature and the new button.

I need to save the signature and add it to the database as an image. I think I need to convert the signature to an bitmap, but not sure how to do this.

Many thanks for any help and advice,

Steve
 
This is code to draw on a bitmap:

Code:
        Dim bit As Bitmap = New Bitmap(Me.Width, Me.Height)
        Dim g As Graphics = Graphics.FromImage(bit)
        Dim myPen As Pen = New Pen(Color.Blue, 3)
 
        g.DrawLine(myPen, 0, 0, Me.Width, Me.Height)

This draws a blue diagonal line of width 3 across the bitmap.

You can replace that last line with a loop looping through your signiture lines, then save the bitmap for use in a database

____________________________________________________________________________
There are only 10 types of people in the world. Those that know binary and those that don't

Brent
 
Hello Brent,

Thanks for your reply.

I have tried to save the bmp.

The Error message I am getting now is on the bmp.Save(signaturePath, ImageFormat.Png) "NotSupportedException"

My code as below:
Code:
 Private Sub butSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butSave.Click
        Try
            Dim bmp As New Bitmap(Me.PictureBox1.Image)

            Dim signaturePath As String = IO.Path.GetDirectoryName(Reflection.Assembly.GetExecutingAssembly.GetName.CodeBase)
            signaturePath = IO.Path.Combine(signaturePath, "signature.png")

            Using g As Graphics = Graphics.FromImage(bmp)
                Using pen As Pen = New Pen(Color.Red, 2)
                    For Each pointList As List(Of Point) In strokeCollection
                        If (pointList.Count >= 2) Then
                            g.DrawLines(pen, pointList.ToArray())
                        End If
                    Next pointList
                End Using
            End Using
            bmp.Save(signaturePath, ImageFormat.Png)

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

Many Many thanks if you could help me more with this problem.

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top