Public class form1 inherits system.windows.Forms.form
#Region "Windows Form Designer Generated Code"
Public Sub new () mybase.new ()
'This call is required for the Windows Form Designer. InitializeComponent ()
'Add any initialization after INITIALIZECOMPONENT ()
End Sub
'Form rewriting Dispose to clean up the list of components. Protected overloads overrides sub dispose (byval disposing as boolean) ing disponation kiln (Components Is Nothing) Then components.dispose () end if endiffs) End sub
'Windows Form Designer Supply Private Components as System.comPonentModel.icontainer
'Note: The following procedure is necessary to use the Windows Form Designer to modify this process using the Windows Form Designer. 'Don't modify it using the code editor.
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox Friend WithEvents Label1 As System.Windows.Forms.Label
End Sub # end region
Dim mousePath As New System.Drawing.Drawing2D.GraphicsPath 'declare a new Graphic path to follow the mouse movement Dim myAlpha As Integer = 100' declare a Alpha variable Dim myUserColor As New Color 'this is a color the user selects Dim myPenWidth As Single = 5 'set Pen Width Variable
Private Sub PictureBox1_mousedown (Byval e as mouseeventargs) Handles PictureBox1.mousedown
If E.BUTTON = MouseButtons.Left the 'Draw A Filled Circle IF LEFT MOUSE IS DOWN
Mousepath.startfigure () 'The l mouse is down sowe need to start a new line in mousepath
END IF
End Sub
Private Sub PictureBox1_mousemove (Byval e as system.windows.forms.mouseeventargs) Handles PictureBox1.mousemove
If E.BUTTON = MouseButtons.Left the 'Draw A Filled Circle IF LEFT MOUSE IS DOWN
Try MousePath.Addline (E.X, E.Y, E.X, E.Y) 'Add Mouse Coordiantes to MousePath
Catch Msgbox ("No Way, Hose!") End Try
END IF
Picturebox1.invalidate () 'Repaint The Picturebox Using The PictureBox1 Paint Event
End Sub
Private sub picturebox1_paint (Byval e as system.windows.forms.painteventargs) Handles PictureBox1.paint
Try
MyuserColor = (System.drawing.color.black) myalpha = 100
DIM Currentpen = New Pen (Color.Fromargb (MyAlpha, MyuserColor), MypenWidth '' set up the pen
E.Graphics.drawpath (currentpen, mousepath) 'DRAW the PATH! :)
Catch 'msgbox ("not happy!") End Try
End Sub
Private Sub Form1_Load (Byval E AS System.Object, Byval E AS System.Eventargs) Handles MyBase.Load