How to write program to find freehand drawing in vb6.0
Steps for creating a program to find freehand drawing in vb6.0
- Open visual basic 6.0
- Create a new form
- Draw one picture box for drawing
- Then Draw six labels for colors and draw three buttons in that two buttons are used to increase and decrease the brush size and one button is used for a clear picture box. (you can draw more buttons and labels as per your requirement)
- After that write the following source code for drawing application
- And then run the program.
Source code for visual basic drawing application
Dim draw As Boolean
Dim cx, cy As Long
Private Sub Command1_Click()
Picdraw.DrawWidth = Picdraw.DrawWidth + 1
End Sub
Private Sub Command2_Click()
Picdraw.DrawWidth = Picdraw.DrawWidth - 1
End Sub
Private Sub Command3_Click()
Picdraw.Cls
End Sub
Private Sub Label1_Click()
Picdraw.ForeColor = vbRed
End Sub
Private Sub Label2_Click()
Picdraw.ForeColor = vbBlue
End Sub
Private Sub Label3_Click()
Picdraw.ForeColor = vbYellow
End Sub
Private Sub Label4_Click()
Picdraw.ForeColor = vbMagenta
End Sub
Private Sub Label5_Click()
Picdraw.ForeColor = vbBlack
End Sub
Private Sub Label6_Click()
Picdraw.ForeColor = vbCyan
End Sub
Private Sub Picdraw_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
draw = True
cx = X
cy = Y
End Sub
Private Sub Picdraw_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If draw = True Then
Picdraw.Line (cx, cy)-(X, Y)
cx = X
cy = Y
End If
End Sub
Private Sub Picdraw_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
draw = False
End Sub
About the program to find freehand drawing in vb6.0
Basically, this is the basic drawing application. In the next post, I will explain the advanced part of the freehand drawing application. For your better understanding first I have given you a basic visual basic drawing application. If anyone wants to need more extra features like an MS-paint application then comment to me in the comment sections, I will guide or provide the source code for that program. By using that source code you can create Your Own Drawing Application with Visual Basic. If you want to know more details about graphics in visual basic then you can also check on Wikipedia.
For creating the paint application in visual basic 6.0 you just need to know the visual basic graphics methods without the method you cannot solve the visual basic graphic program. If you want to how to create a paint application in visual basic 6.0 then you can get the solution by following this post. You can also join us for an advanced program of freehand drawing in vb6.0.
How to work visual basic drawing application
If you are familiar with the paint application then you can easily understand how to work this application. Yes! This application works like a paint application but now some features are not added in this application although you can say that paint application in visual basic. Because this program's concept is based on the paint application.
In this application, you can draw anything, for drawing you can increase and decrease the brush size and also change the color of the brush. After the drawing, you can also clear your drawing by pressing the clear button. I know most of the paints feature are not available here but don’t worry that will be available in the next advanced version. If anyone tells you how to create a paint application in visual basic 6.0 then you can suggest this program for that.
1 Comments
Thanks, this freehand drawing application is helpful for me in my college project. I think this is very simple coding than others for freehand drawing in vb 6.0.
ReplyDelete