basic drawing program in vb (plz sticky)

Post here about scripting and programming for HaloPC (audio, network, ai, etc.)
Post Reply
Thebirthdayhat





Posts: 94
Joined: Mon Nov 15, 2004 7:01 pm
Location: over there

basic drawing program in vb (plz sticky)

Post by Thebirthdayhat »

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:

Code: Select all

picbox1.AutoRedraw = True
im not 2 sure wat that does but it works. on to the next part

3. next line in the forms code type in

Code: Select all

picbox1.DrawWidth = 2
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

Code: Select all

picbox1.BackColor = vbWhite
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

Code: Select all

Dim I As Integer

in the forms code

6. now in the boxes coding type

Code: Select all

frmpicmaker.ScaleMode = vbPixels
that means that in the form the unit of measurement will be pixels

7. and now put

Code: Select all

picbox1.ForeColor = vbBlack
meaning that the default color of the writing is black

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
to be continued
Last edited by Thebirthdayhat on Mon Dec 20, 2004 1:53 pm, edited 1 time in total.
Signature exceeded 3 lines of text.
Thebirthdayhat





Posts: 94
Joined: Mon Nov 15, 2004 7:01 pm
Location: over there

Post by Thebirthdayhat »

updateness*
k if uve finished all that up there than u should have a program with a drawing stage on it and that draws in black

k now im gonna teach u how to add colors to it.
1. make a comand button and rename it to cmdblue
2. make it a small square like the paletes r in paint and stuff
3. in the properties window change the style propertiy to graphical
4. in the backcolor property change it to blue
5. take out the caption
6. double click it to go into its code
type in

Code: Select all

picbox1.ForeColor = vbBlue
now test it out and c if it works


Next were gonna make a button that changes the backround color to green
1. make a comand button and rename it to cmdgreenback
2. make it a small square like the paletes r in paint and stuff
3. in the properties window change the style propertiy to graphical
4. in the backcolor property change it to green
5. take out the caption
6. double click it to go into its code
type in

Code: Select all

picbox1.BackColor = vbGreen
test that out


heres how to make a button to change line width
1. make a command button named cmd5pixel
2. change the size caption and everything to watever u want
3. double click it to open its code
4. in the code type in

Code: Select all

picbox1.DrawWidth = 5
and try it out, it should make the lines u make thicker


heres how to make a button to clear the screen
1. make a comand button that says clear, name dont matter
2. in its code type

Code: Select all

picbox1.Cls
easy enough

now this is how to make an eraser button
1. make a button name dont matter and make caption say eraser
2. double click to open its code and put in
3. picbox1.ForeColor = picbox1.BackColor
test that out 2, it should erase everthing but the backround

ill update this topic more if i learn how to make line, circle, square tools, and stuff like that, but if any1 does no of anything to add to this can u plzz tell me or refer me to a tut on that
Signature exceeded 3 lines of text.
~{DE}~Demolisher





Posts: 100
Joined: Thu Dec 02, 2004 8:35 am
Location: MS,USA
Contact:

Post by ~{DE}~Demolisher »

Plz PM me the free demo version of vb5 if you have it :D
And ofcourse not a cracked version of the whole thing i dont wanna get caught with it so if you dont mind just send me the ree demo version no cracks plz.
Last edited by ~{DE}~Demolisher on Tue Dec 21, 2004 6:44 pm, edited 1 time in total.
Signature exceeded 75KB.
Thebirthdayhat





Posts: 94
Joined: Mon Nov 15, 2004 7:01 pm
Location: over there

Post by Thebirthdayhat »

for su,m reason when i tried pm ing it to my laptop it didnt work, it just said there where some missing files or sumthing, if i could i would, can any1 tell me how 2?
Signature exceeded 3 lines of text.
Oosty





Posts: 84
Joined: Thu Sep 16, 2004 6:27 pm
Location: Australia
Contact:

Post by Oosty »

Signature exceeded 75KB.
sparkicks





Posts: 151
Joined: Sat May 15, 2004 8:07 am

Post by sparkicks »

just thought i would ask why this hasnt been skickied cus its a dam lot of writing .
Sentinel





Posts: 420
Joined: Thu Nov 04, 2004 1:18 pm

Post by Sentinel »

ill see what i can do about a sticky[/quote]
I don't have a sig....
User avatar
Locke




Socialist Advisor Translator

Posts: 2225
Joined: Fri Aug 06, 2004 1:42 am
Location: Woot.com
Contact:

Post by Locke »

Some pics would be nice. If you get them, Ill sticky it
Great tut though
Image
Feel free to send me an instant message if you need anything.
Post Reply