Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 882
  • Last Modified:

Display OpenNetCf Signature control output on a desktop PC

Hi,
I have a Windows CE4.2 application which uses the OpenNetCF Library of controls, one of which is the signature control. When a user enters their signature and saves it I put the signature into a byte array using the 'GetSignatureEx' method and store it in an Image datatype in Sql Server 2000. This works fine and im able to save and view signatures using the Signature control, however I have a requirement to view the Signature from a standard Desktop application (full 1.1 framework). When i read in the byte array to a memory stream and use the FromStream method to create an Image I get an Invalid Parameter error.

Heres the code giving me grief:
Dim mem As New IO.MemoryStream(myByteArray)
 mem.Write(myByteArray, 0, myByteArray)
lblSigned.Image = Image.FromStream(mem)

Does anyone have much experience using the openNetCf Signature control?
I suspect its something to do with the way the control stores the image is the byteArray when it is first saved.

Thanks for your help,
Ian
0
bean_ian
Asked:
bean_ian
  • 2
1 Solution
 
bean_ianAuthor Commented:
Thanks Mikal but the problem is not displaying the signature on the pocket pc but rather on a standard desktop. I want to show the signature on a desktop pc running the 1.1 framework.
Has anyone successfully done this using this particular control?
0
 
bean_ianAuthor Commented:
i have since found out that the OpenNetCf signature control store an array of line points rather than the bitmap in the database. here is code i wrote that reconstructs these line points into an image.
 Private Sub reconstructSignature(ByVal e As System.Windows.Forms.PaintEventArgs, ByVal sigIn() As Byte)
        'This method takes an open net cf signature and reconstructs it into a label'
        Try

            ' DrawSignature(e.Graphics)
            Dim g As Graphics
            ' background
            g = e.Graphics
            g.Clear(Color.Cornsilk)

            ' border
            g.DrawRectangle(Pens.Black, 0, 0, 232, 64)
            g.SmoothingMode = SmoothingMode.AntiAlias
            Dim line As New Point
            Dim i As Int32
            For i = 0 To sigIn.Length - 4 Step 2
                If sigIn(i) <> 0 And sigIn(i + 1) <> 0 And sigIn(i + 2) <> 0 And sigIn(i + 3) <> 0 Then
                    g.DrawLine(Pens.Black, sigIn(i), sigIn(i + 1), sigIn(i + 2), sigIn(i + 3))
                End If
            Next
        Catch ex As Exception
            FormManager.showError(ex)
        End Try
    End Sub
0
 
Computer101Commented:
Closed, 500 points refunded.
Computer101
EE Admin
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now