Public Class Form1
    Dim p As New Pen(Color.Blue, 2) ' Задаем новое перо
    Dim g As Graphics
    Dim lx As New Point()
    Dim ly As New Point()
    Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
        'Задаем начальные точки координат
        lx.X = e.X
        lx.Y = e.Y
        'Точки для ly должны быть такие же
        ly = lx
    End Sub
    Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
        If e.Button = MouseButtons.Left Then
            ' Рисуем временную линию с координатами lx и ly, черным цветом
            ControlPaint.DrawReversibleLine(Me.PointToScreen(lx), Me.PointToScreen(ly), Color.Black)
            ly = New Point(e.X, e.Y)
            ControlPaint.DrawReversibleLine(Me.PointToScreen(lx), Me.PointToScreen(ly), Color.Black)
        End If
    End Sub
    Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
        ControlPaint.DrawReversibleLine(Me.PointToScreen(lx), Me.PointToScreen(lx), Color.Black) ' Заканчиваем рисовать временную линию
        g.DrawLine(p, lx, ly) ' Рисуем линию
    End Sub
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        g = Me.CreateGraphics() ' Рисуем по форме
    End Sub
End Class
      