VB6 - Updated Paint Tutorial
Posted: Tue Nov 03, 2009 2:45 am
Hello,
This tutorial assumes you have a basic knowledge of Visual Basic 6 and have made a few apps with it.
I am going to tell you how to make a more advanced painting application in Visual Basic 6.
This time it will be easier to follow as I will use my Step-By-Step thing.
NOTE: To make this painting application, you must NOT have Visual Basic 6 Portable. VB6 MUST be installed.
Here we go:
1. Open VB6 and create a new Standard Exe project.
2. Resize your form and rename it.
3. Add the following:
1 Picturebox - Name: Paint Appearance: 0-Flat
3 Buttons - Names: cmdColor, cmdSize, cmdExit Captions: Color, Size, Exit
1 Commondialog control
4. Now all we need is the code! Here it is:
Enjoy!
~GoodGuy17~
This tutorial assumes you have a basic knowledge of Visual Basic 6 and have made a few apps with it.
I am going to tell you how to make a more advanced painting application in Visual Basic 6.
This time it will be easier to follow as I will use my Step-By-Step thing.
NOTE: To make this painting application, you must NOT have Visual Basic 6 Portable. VB6 MUST be installed.
Here we go:
1. Open VB6 and create a new Standard Exe project.
2. Resize your form and rename it.
3. Add the following:
1 Picturebox - Name: Paint Appearance: 0-Flat
3 Buttons - Names: cmdColor, cmdSize, cmdExit Captions: Color, Size, Exit
1 Commondialog control
4. Now all we need is the code! Here it is:
Code: Select all
5. That's it! 5 easy steps! Run your program, and if it works you are a good reader!Dim Drawing As Boolean
Private Sub cmdColor_Click()
CommonDialog1.CancelError = True
CommonDialog1.Flags = CC_RGBINIT Or CC_FULLOPEN
CommonDialog1.Action = 3
Paint.ForeColor = CommonDialog1.Color
End Sub
Private Sub cmdExit_Click()
End
End Sub
Private Sub cmdSize_Click()
Dim strSize
strSize = InputBox("Enter a value.")
Paint.DrawWidth = strSize
End Sub
Private Sub Form_Load()
Drawing = False
End Sub
Private Sub Paint_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Drawing = True
Paint.CurrentX = X
Paint.CurrentY = Y
End Sub
Private Sub Paint_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Drawing = True Then
Paint.Line -(X, Y), Paint.ForeColor
End If
End Sub
Private Sub Paint_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Drawing = False
End Sub
Enjoy!
~GoodGuy17~