PLease Help me with my Paint Program... (1 Viewer)

Aphrael_87

New Member
Joined
Nov 7, 2004
Messages
22
Location
Wollongong
Gender
Female
HSC
N/A
Ok, here's the deal, Im just about to begin writing a Paint Program in VB, has anyone done that before? Ive never encountered this, and im not sure on how to do it, i just fiished a number puzzle game, and im soooooo over arrays, do i need to use arrays? Any help would be greatly appreciated
:(
 

Fosweb

I could be your Doctor...
Joined
Jun 20, 2003
Messages
594
Location
UNSW. Still.
Gender
Male
HSC
2003
Simple.

1. Set up a picture box with a scale horizontal and vertical.
2. Get the position the user clicks with the mouse in terms of X and Y.
3. Change the colour of the coordinate that corrosponds to the X and Y of the mouseclick.

Blah. Simple.
 

MedNez

:o>---<
Joined
Aug 21, 2004
Messages
3,004
Gender
Male
HSC
N/A
Haha, nice summary. We had a paint component of our major project, worked great :D
 

Aphrael_87

New Member
Joined
Nov 7, 2004
Messages
22
Location
Wollongong
Gender
Female
HSC
N/A
BabieBubski said:
Yes! You will have to use ARRAYS... i know its hard... but yeh... u *do* have to use them!!!
Wat kind of game are you making?
Its a Paint Program, so far i can draw circles ^_^yay!!! Thanks.
 

elspethlove

New Member
Joined
Nov 19, 2004
Messages
2
Location
Wollongong
Gender
Female
HSC
2005
yeah you do have to use arrays. You also have to create a button to intsert every HP pics you can see? thats how you pass, don't worry, it'll be *cute*
 

Fosweb

I could be your Doctor...
Joined
Jun 20, 2003
Messages
594
Location
UNSW. Still.
Gender
Male
HSC
2003
Quit it with arrays!

All you need to do is track where to mouse goes when you push the mouse button over the picture box. And then draw those pixels.

Now you want to get when the person presses the mouse, and when they move the mouse, so the same code goes in both the mouseDown and mouseClick events...

Add a picturebox called picMain to your form
Code:
Private Sub picMain_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button = 1 Then
    picMain.PSet (X, Y), vbBlack
End If

End Sub
Button = 1 [this is the left mouse button]
.PSet draws a pixel, X, Y are coords, vbBlack takes the place of whatever colour you want there... Make that a variable, and get the user to select the colour from a common dialog (the colourpicker one...)

yay... very primitive... very...
 
Last edited:

Fosweb

I could be your Doctor...
Joined
Jun 20, 2003
Messages
594
Location
UNSW. Still.
Gender
Male
HSC
2003
More things for you to think about:

- The .DrawWidth property of a picture box. (Will change the 'thickness' or width of a line or pixel.

- An eraser is just white (vbWhite) coloured pen

- Lines are drawn with a start X,Y coordinate, collected from the mouseDown event, and a finish X,Y coordinate, from the mouseUp event

- Circles are .Circle ( you know this)

- .Cls you should know as clearscreen.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top