-
Hi,
I'm supposed to make a program similar to (microsoft) PAINT. You should be able to make rectangles, lines, circles, ovals, free hand drawings, define color, fill the circle/oval with a color. Also, you should be able to save, open and do all that stuff.
Does anyone have code or tutorials for such a program? Especially how to make the tools for drawing circles and other shapes. Help me, I'm stuck!!
-
Well all you need basically is a picturebox.
And then some buttons to denote tools.
When I did something similar to this, I stored a list of everything that had been drawn in arrays.
Something like :
Code:
Private Type Rectangle() As myRect
Private Type myRect
TopLeft As myPoint
TopRight As myPoint
BottomLeft As myPoint
BottomRight As myPoint
End Type
Private Type Circle() As myCircle
Private Type myCircle
Centre As myPoint
Radius As Integer
End Type
Private Type myPoint
X As Integer
Y As Integer
End Type
Then, when the user clicks on a tool, you remember what 'mode' you are in. When they move the pointer over the picturebox, you clear it, repaint it with the above shapes (etc.), and then do whatever it is that the 'mode' states.
For example, if you're in line drawing mode, and they click on the picturebox, you should put a point there. Then every time they move the pointer, you clear the picturebox, redraw the shapes, redraw the point, and draw a line from the point to the pointer. Then when they click again, you would draw that line, and store it in a UDT.
That help ?
- jamie
-
1 Attachment(s)
Hi,
I've attached a program I did at College. It allows:
- Freehand Drawing
- Lines
- Boxes
- Circles (Needs work!!!)
- Line widths
- Fill styles
Hope this helps,
:)