basic drawing program in vb (plz sticky)
Posted: Sun Dec 19, 2004 6:33 pm
k this tut will teach u how to make a drawing program in vb 5 and maybe 6, i dunno if the code is same in 6
k step 1:
open up a new form named frmpicmaker. and on it put a picture box in it.
name the picture box picbox1
2. double click the form (not the picbox) and bring up its code, in there type:
im not 2 sure wat that does but it works. on to the next part
3. next line in the forms code type in
that makes it so when u draw the default line size will be 2 units
4. next line still in the code of the form type
that makes it so the backround of the picture box is white
5. heres sumthing else that i dont no wat it does but it works, type
in the forms code
6. now in the boxes coding type
that means that in the form the unit of measurement will be pixels
7. and now put
meaning that the default color of the writing is black
8.now go down a few lines from theforms coding and put in
to be continued
k step 1:
open up a new form named frmpicmaker. and on it put a picture box in it.
name the picture box picbox1
2. double click the form (not the picbox) and bring up its code, in there type:
Code: Select all
picbox1.AutoRedraw = True
3. next line in the forms code type in
Code: Select all
picbox1.DrawWidth = 2
4. next line still in the code of the form type
Code: Select all
picbox1.BackColor = vbWhite
5. heres sumthing else that i dont no wat it does but it works, type
Code: Select all
Dim I As Integer
in the forms code
6. now in the boxes coding type
Code: Select all
frmpicmaker.ScaleMode = vbPixels
7. and now put
Code: Select all
picbox1.ForeColor = vbBlack
8.now go down a few lines from theforms coding and put in
Code: Select all
Private Sub picbox1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
picbox1.Line (X, Y)-(X, Y)
End If
End Sub
9. now down a few more spaces and put
[code]Private Sub picbox1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
picbox1.Line -(X, Y)
End If
End Sub