M
Manuel Daponte
I found this code in this newsgroup and used it, but the lines drawn
are composed of point too separated when the mouse moves at medium or
fast speed. How can I fix it?
Thanks in advance !!!
Dim bTracking As Boolean
Dim blackPen As Pen
Dim g As Graphics
Private Sub frmFirma_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
blackPen = New Pen(Color.Black, 2)
blackPen.LineJoin = Drawing2D.LineJoin.Round
g = PictureBox1.CreateGraphics()
End Sub
Private Sub AddPoint(ByVal e As
System.Windows.Forms.MouseEventArgs)
g.DrawLine(blackPen, e.X, e.Y, e.X + 1, e.Y + 1)
End Sub
Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e
As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
bTracking = True
AddPoint(e)
End Sub
Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e
As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
If bTracking Then
AddPoint(e)
End If
End Sub
Private Sub PictureBox1_MouseUp(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseUp
If bTracking Then
AddPoint(e)
bTracking = False
End If
End Sub
Protected Overrides Sub Finalize()
g.Dispose()
MyBase.Finalize()
End Sub
are composed of point too separated when the mouse moves at medium or
fast speed. How can I fix it?
Thanks in advance !!!
Dim bTracking As Boolean
Dim blackPen As Pen
Dim g As Graphics
Private Sub frmFirma_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
blackPen = New Pen(Color.Black, 2)
blackPen.LineJoin = Drawing2D.LineJoin.Round
g = PictureBox1.CreateGraphics()
End Sub
Private Sub AddPoint(ByVal e As
System.Windows.Forms.MouseEventArgs)
g.DrawLine(blackPen, e.X, e.Y, e.X + 1, e.Y + 1)
End Sub
Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e
As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
bTracking = True
AddPoint(e)
End Sub
Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e
As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
If bTracking Then
AddPoint(e)
End If
End Sub
Private Sub PictureBox1_MouseUp(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseUp
If bTracking Then
AddPoint(e)
bTracking = False
End If
End Sub
Protected Overrides Sub Finalize()
g.Dispose()
MyBase.Finalize()
End Sub