Digital Sign
Hello.
I have to store contract signatures in a database. I'm using an example that I found here some time ago.
The question is, I can sign with the optical pen but I can't record the generated image. I have to generate a jpg and link that image to a picturebox. However, if the customer is not happy with the quality of the signature, I cannot repeat the process without first closing the screen and reopening it.
Is there a way after signing I can record in the bank without having to generate a jpg linked to a picturebox?
Below is the code I am using.
Thank you for everyone's attention and cooperation.
Code:
Dim myMs As New IO.MemoryStream
Dim xStart, yStart, xEnd, yEnd As Integer
Dim Drawbitmap As Bitmap
Dim DrawbitmapResp As Bitmap
Dim Drawgraphics As Graphics
Dim DrawgraphicsResp As Graphics
Dim myPen As New Pen(Color.BlueViolet, 3)
Dim myColor As Color = Color.Blue
Dim myBrush As New Drawing.SolidBrush(Color.Black)
Dim myBrushWidth As Integer
Dim ContinuousFlag As Boolean
Private Sub PreparaBox()
Drawbitmap = New Bitmap(PictFpd.Width, PictFpd.Height)
Drawgraphics = Graphics.FromImage(Drawbitmap)
PictFpd.Image = Drawbitmap
Drawgraphics.Clear(Color.White)
myBrushWidth = 4
End Sub
Private Sub drawMyline()
PictFpd.Image = Drawbitmap
Drawgraphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
Drawgraphics.DrawLine(myPen, xStart, yStart, xEnd, yEnd)
End Sub
Private Sub Pictfpd_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictFpd.MouseDown
xStart = Control.MousePosition.X - (Me.Left + PictFpd.Left + 4)
yStart = Control.MousePosition.Y - (Me.Top + PictFpd.Top + 31)
If RadioButton1.Checked = True Then
ContinuousFlag = True
End If
End Sub
Private Sub Pictfpd_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictFpd.MouseMove
If ContinuousFlag Then
Drawgraphics.SmoothingMode = Drawing2D.SmoothingMode.None
Drawgraphics.FillEllipse(myBrush, e.X, e.Y, myBrushWidth, myBrushWidth)
PictFpd.Image = Drawbitmap
End If
End Sub
Private Sub Pictfpd_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictFpd.MouseUp
xEnd = Control.MousePosition.X - (Me.Left + PictFpd.Left + 4)
yEnd = Control.MousePosition.Y - (Me.Top + PictFpd.Top + 31)
If RadioButton1.Checked Then
ContinuousFlag = False
Else
drawMyline()
End If
End Sub
Private Sub BotaoSalvar_Click(sender As Object, e As EventArgs) Handles BotaoSalvar.Click
If CodigoUsuario = 0 Then MsgE("Escolha o Usuário") : Exit Sub
PictFpd.Image.Save("C:\temp\" & CodigoUsuario & ".jpg")
PictFpd.Load("C:\temp\" & CodigoUsuario & ".jpg")
With NovoSign
If Not IsNothing(PictFpd.Image) Then
PictFpd.Image.Save(myMs, PictFpd.Image.RawFormat)
.PArrImage = myMs.ToArray
.PCodCli = CodigoUsuario
.PCodTipoCli = 3
If .SalvarSign = False Then Exit Sub
Msg("Sucess")
End If
End With
End Sub