Hi there.
I'd like to allow the user to create some free-form drawing in my
application, in the style of Microsoft Paint (the Brush tool) or Paint.Net.
I've looked through Paint.Net's source code, but could not quite understand
it... :$
So.. what should I do? are there any tutorials?
I've got some code working, but this codes creates a non continuous line and
is kind of slow..
My code is
If desenhar = False Then Exit Sub
Static x As Integer
Static y As Integer
Me.Text = x & " " & e.X & " " & y & " " & e.Y
If e.Button = MouseButtons.Left Then
Dim caneta As New Pen(Color.Gold, 5)
Dim Imagem As Image = Me.PBoxShow.Image
Dim G As Graphics = Graphics.FromImage(imagem)
g.DrawLine(caneta, x, y, e.X, e.Y)
Me.Text = x & " " & e.X & " " & y & " " & e.Y
PBoxShow.Image = imagem
ElseIf e.Button = MouseButtons.Right Then
Dim caneta As New Pen(Color.Navy, 5)
Dim Imagem As Image = Me.PBoxShow.Image
Dim G As Graphics = Graphics.FromImage(imagem)
g.DrawLine(caneta, x, y, e.X, e.Y)
PBoxShow.Image = imagem
End If
x = e.X
y = e.Y
End Sub
Thank you in advance!