Drawing

Learn to make a basic Drawing package using Visual Basic 6 with this Tutorial that Celebrates the CESPage 25th Anniversary

his will show you how to put an Icon in the Task Tray and make a Popup Menu appear when you Right Click on the Icon within the Task Tray, this Tutorial is presenting using the original Images and Code.

Step 1

Load Microsoft Visual Basic, then select Standard EXE Project if VB5/6, click on the option then click Open
New Project

Step 2

A Blank Form named Form1 should then appear
Blank Form

Step 3

Then from the Visual Basic Components Menu Select the Picture Box Control:
Picture Box Control

Step 4

Draw a Picture Box on the Form
Form with Picture Box

Step 5

Then goto the Properties Box and change the AutoRedraw property to True
Picture Box AutoRedraw Property

Step 6

Double Click on the PictureBox of Picture1 and type in the Picture1_MouseDown() Sub:


Picture1.CurrentX = X
Picture1.CurrentY = Y
                                    

Step 7

Double Click on the PictureBox of Picture1 and type in the Picture1_MouseMove() Sub:


If Button = 1 Then
    Picture1.Line (Picture1.CurrentX, Picture1.CurrentY)-(X, Y), vbBlack
End If  
                                    

Step 8

Save the Project, for example prjDrawing, into a vacant folder as you have finished the application. Click on Start / Run
Start / Run
This should Start the application
Drawing Running

Step 9

Now place the Mouse Cursor over the Picture Box (the recessed area), press the Left Mouse Button and move it about, or try and write something
Drawing Drawn

Step 8

To close the application just Click the X in the corner or End / Stop
End / Stop

This is a very simple Drawing Package, try changing the DrawWidth property of the Picture Box to get a Thicker line, or the Colour by using another vbColour e.g. vbBlue or vbRed!