Capturing signature using PictureBox and Bitmap

J

Jarf

Hello all,

I hope you can help me with this. I'm trying to capture a signature in
a bitmap, copy it to the clip board and then paste it in a richtext
box.

My issue is that when I copy the signature to the clipboard and paste
it into the richtextbox the background color is blue??? I'm not sure
why this is happening and cannot seem to change it.

Any suggestions or ideas would be appreciated. Code is below.

Thanks,
Jeff

Here is what I'm doing right now....

Private xpt As Integer
Private ypt As Integer
Private bdrawing As Boolean = False
Private bm As Bitmap
Private gr As Graphics
Private p As Pen

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
bm = New Bitmap(PictureBox1.Width, PictureBox1.Height)
p = New Drawing.Pen(Color.Black)
gr = Graphics.FromImage(bm)
End Sub

Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e
As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
bdrawing = True
xpt = e.X
ypt = e.Y
End Sub

Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e
As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
If bdrawing Then
gr.DrawLine(p, xpt, ypt, e.X, e.Y)
xpt = e.X
ypt = e.Y
PictureBox1.Image = bm
End If
End Sub

Private Sub PictureBox1_MouseUp(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseUp
bdrawing = False
End Sub

Private Sub PictureBox1_MouseLeave(ByVal sender As Object, ByVal e
As System.EventArgs) Handles PictureBox1.MouseLeave
bdrawing = False
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Clipboard.SetDataObject(bm.Clone, True)
RichTextBox1.Paste()
End Sub
 

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